clang 20.0.0git
|
#include "clang/Sema/SemaInternal.h"
Public Member Functions | |
TypoCorrectionConsumer (Sema &SemaRef, const DeclarationNameInfo &TypoName, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, std::unique_ptr< CorrectionCandidateCallback > CCC, DeclContext *MemberContext, bool EnteringContext) | |
bool | includeHiddenDecls () const override |
Determine whether hidden declarations (from unimported modules) should be given to this consumer. | |
void | FoundDecl (NamedDecl *ND, NamedDecl *Hiding, DeclContext *Ctx, bool InBaseClass) override |
Invoked each time Sema::LookupVisibleDecls() finds a declaration visible from the current scope or context. | |
void | FoundName (StringRef Name) |
void | addKeywordResult (StringRef Keyword) |
void | addCorrection (TypoCorrection Correction) |
bool | empty () const |
TypoResultList & | operator[] (StringRef Name) |
Return the list of TypoCorrections for the given identifier from the set of corrections that have the closest edit distance, if any. | |
unsigned | getBestEditDistance (bool Normalized) |
Return the edit distance of the corrections that have the closest/best edit distance from the original typop. | |
void | addNamespaces (const llvm::MapVector< NamespaceDecl *, bool > &KnownNamespaces) |
Set-up method to add to the consumer the set of namespaces to use in performing corrections to nested name specifiers. | |
const TypoCorrection & | getNextCorrection () |
Return the next typo correction that passes all internal filters and is deemed valid by the consumer's CorrectionCandidateCallback, starting with the corrections that have the closest edit distance. | |
const TypoCorrection & | getCurrentCorrection () |
Get the last correction returned by getNextCorrection(). | |
const TypoCorrection & | peekNextCorrection () |
Return the next typo correction like getNextCorrection, but keep the internal state pointed to the current correction (i.e. | |
bool | hasMadeAnyCorrectionProgress () const |
In the case of deeply invalid expressions, getNextCorrection() will never be called since the transform never makes progress. | |
void | resetCorrectionStream () |
Reset the consumer's position in the stream of viable corrections (i.e. | |
bool | finished () |
Return whether the end of the stream of corrections has been reached. | |
void | saveCurrentPosition () |
Save the current position in the correction stream (overwriting any previously saved position). | |
void | restoreSavedPosition () |
Restore the saved position in the correction stream. | |
ASTContext & | getContext () const |
const LookupResult & | getLookupResult () const |
bool | isAddressOfOperand () const |
const CXXScopeSpec * | getSS () const |
Scope * | getScope () const |
CorrectionCandidateCallback * | getCorrectionValidator () const |
Public Member Functions inherited from clang::VisibleDeclConsumer | |
virtual | ~VisibleDeclConsumer () |
Destroys the visible declaration consumer. | |
virtual bool | includeHiddenDecls () const |
Determine whether hidden declarations (from unimported modules) should be given to this consumer. | |
virtual void | FoundDecl (NamedDecl *ND, NamedDecl *Hiding, DeclContext *Ctx, bool InBaseClass)=0 |
Invoked each time Sema::LookupVisibleDecls() finds a declaration visible from the current scope or context. | |
virtual void | EnteredContext (DeclContext *Ctx) |
Callback to inform the client that Sema entered into a new context to find a visible declaration. | |
Definition at line 81 of file SemaInternal.h.
|
inline |
Definition at line 87 of file SemaInternal.h.
References clang::LookupResult::suppressDiagnostics().
void TypoCorrectionConsumer::addCorrection | ( | TypoCorrection | Correction | ) |
Definition at line 4547 of file SemaLookup.cpp.
References checkCorrectionVisibility(), D, clang::TypoCorrection::getAsString(), clang::TypoCorrection::getCorrectionAsIdentifierInfo(), clang::TypoCorrection::getCorrectionDecl(), clang::Decl::getDeclContext(), clang::TypoCorrection::getEditDistance(), clang::TypoCorrection::getFoundDecl(), clang::Sema::getLangOpts(), clang::IdentifierInfo::getName(), isCandidateViable(), clang::Decl::isDeprecated(), clang::TypoCorrection::isResolved(), and MaxTypoDistanceResultSets.
void TypoCorrectionConsumer::addKeywordResult | ( | StringRef | Keyword | ) |
Definition at line 4518 of file SemaLookup.cpp.
Referenced by AddKeywordsToConsumer().
void TypoCorrectionConsumer::addNamespaces | ( | const llvm::MapVector< NamespaceDecl *, bool > & | KnownNamespaces | ) |
Set-up method to add to the consumer the set of namespaces to use in performing corrections to nested name specifiers.
This method also implicitly adds all of the known classes in the current AST context to the to the consumer for correcting nested name specifiers.
Definition at line 4609 of file SemaLookup.cpp.
References clang::Sema::getASTContext(), clang::NestedNameSpecifier::getAsType(), clang::Type::getTypeClass(), clang::ASTContext::getTypes(), and clang::T.
|
inline |
Definition at line 115 of file SemaInternal.h.
|
inline |
Return whether the end of the stream of corrections has been reached.
Definition at line 181 of file SemaInternal.h.
|
overridevirtual |
Invoked each time Sema::LookupVisibleDecls()
finds a declaration visible from the current scope or context.
ND | the declaration found. |
Hiding | a declaration that hides the declaration ND , or NULL if no such declaration exists. |
Ctx | the original context from which the lookup started. |
InBaseClass | whether this declaration was found in base class of the context we searched. |
Implements clang::VisibleDeclConsumer.
Definition at line 4491 of file SemaLookup.cpp.
References FoundName(), clang::NamedDecl::getIdentifier(), and clang::LookupResult::isVisible().
void TypoCorrectionConsumer::FoundName | ( | StringRef | Name | ) |
Definition at line 4512 of file SemaLookup.cpp.
Referenced by FoundDecl().
Return the edit distance of the corrections that have the closest/best edit distance from the original typop.
Definition at line 127 of file SemaInternal.h.
References clang::TypoCorrection::NormalizeEditDistance().
|
inline |
Definition at line 197 of file SemaInternal.h.
References clang::Sema::Context.
|
inline |
Definition at line 203 of file SemaInternal.h.
|
inline |
Get the last correction returned by getNextCorrection().
Definition at line 150 of file SemaInternal.h.
|
inline |
Definition at line 198 of file SemaInternal.h.
const TypoCorrection & TypoCorrectionConsumer::getNextCorrection | ( | ) |
Return the next typo correction that passes all internal filters and is deemed valid by the consumer's CorrectionCandidateCallback, starting with the corrections that have the closest edit distance.
An empty TypoCorrection is returned once no more viable corrections remain in the consumer.
Definition at line 4639 of file SemaLookup.cpp.
References clang::TypoCorrection::isResolved(), and clang::TypoCorrection::requiresImport().
Referenced by peekNextCorrection().
|
inline |
Definition at line 202 of file SemaInternal.h.
|
inline |
Definition at line 201 of file SemaInternal.h.
|
inline |
In the case of deeply invalid expressions, getNextCorrection()
will never be called since the transform never makes progress.
If we don't detect this we risk trying to correct typos forever.
Definition at line 170 of file SemaInternal.h.
|
inlineoverridevirtual |
Determine whether hidden declarations (from unimported modules) should be given to this consumer.
By default, they are not included.
Reimplemented from clang::VisibleDeclConsumer.
Definition at line 106 of file SemaInternal.h.
|
inline |
Definition at line 200 of file SemaInternal.h.
|
inline |
Return the list of TypoCorrections for the given identifier from the set of corrections that have the closest edit distance, if any.
Definition at line 121 of file SemaInternal.h.
|
inline |
Return the next typo correction like getNextCorrection, but keep the internal state pointed to the current correction (i.e.
the next time getNextCorrection is called, it will return the same correction returned by peekNextcorrection).
Definition at line 160 of file SemaInternal.h.
References getNextCorrection().
|
inline |
Reset the consumer's position in the stream of viable corrections (i.e.
getNextCorrection() will return each of the previously returned corrections in order before returning any new corrections).
Definition at line 175 of file SemaInternal.h.
|
inline |
Restore the saved position in the correction stream.
Definition at line 193 of file SemaInternal.h.
|
inline |
Save the current position in the correction stream (overwriting any previously saved position).
Definition at line 188 of file SemaInternal.h.