clang: clang::TypoCorrection Class Reference (original ) (raw )Simple class containing the result of [Sema::CorrectTypo](classclang%5F1%5F1Sema.html#a6120561015b463e46bc6e299de250c6f "Try to "correct" a typo in the source code by finding visible declarations whose names are similar to..."). More...
#include "[clang/Sema/TypoCorrection.h](TypoCorrection%5F8h%5Fsource.html)"
Public Member Functions
TypoCorrection (const DeclarationName &Name, NamedDecl *NameDecl, NestedNameSpecifier *NNS=nullptr, unsigned CharDistance=0, unsigned QualifierDistance=0)
TypoCorrection (NamedDecl *Name, NestedNameSpecifier *NNS=nullptr, unsigned CharDistance=0)
TypoCorrection (DeclarationName Name, NestedNameSpecifier *NNS=nullptr, unsigned CharDistance=0)
TypoCorrection ()=default
DeclarationName
getCorrection () const
Gets the DeclarationName of the typo correction.
IdentifierInfo *
getCorrectionAsIdentifierInfo () const
NestedNameSpecifier *
getCorrectionSpecifier () const
Gets the [NestedNameSpecifier](classclang%5F1%5F1NestedNameSpecifier.html "Represents a C++ nested name specifier, such as "::std::vector::".") needed to use the typo correction.
void
setCorrectionSpecifier (NestedNameSpecifier *NNS)
void
WillReplaceSpecifier (bool ForceReplacement)
bool
WillReplaceSpecifier () const
void
setQualifierDistance (unsigned ED)
void
setCallbackDistance (unsigned ED)
unsigned
getEditDistance (bool Normalized=true ) const
Gets the "edit distance" of the typo correction from the typo.
NamedDecl *
getFoundDecl () const
Get the correction declaration found by name lookup (before we looked through using shadow declarations and the like).
NamedDecl *
getCorrectionDecl () const
Gets the pointer to the declaration of the typo correction.
template
DeclClass *
getCorrectionDeclAs () const
void
ClearCorrectionDecls ()
Clears the list of NamedDecls.
void
setCorrectionDecl (NamedDecl *CDecl)
Clears the list of NamedDecls before adding the new one.
void
setCorrectionDecls (ArrayRef < NamedDecl * > Decls)
Clears the list of NamedDecls and adds the given set.
void
addCorrectionDecl (NamedDecl *CDecl)
Add the given NamedDecl to the list of NamedDecls that are the declarations associated with the DeclarationName of this TypoCorrection .
std::string
getAsString (const LangOptions &LO) const
std::string
getQuoted (const LangOptions &LO) const
operator bool () const
Returns whether this TypoCorrection has a non-empty DeclarationName .
void
makeKeyword ()
Mark this TypoCorrection as being a keyword.
bool
isKeyword () const
template<std::size_t StrLen>
bool
isKeyword (const char(&Str)[StrLen]) const
bool
isResolved () const
bool
isOverloaded () const
void
setCorrectionRange (CXXScopeSpec *SS, const DeclarationNameInfo &TypoName)
SourceRange
getCorrectionRange () const
decl_iterator
begin ()
decl_iterator
end ()
const_decl_iterator
begin () const
const_decl_iterator
end () const
bool
requiresImport () const
Returns whether this typo correction is correcting to a declaration that was declared in a module that has not been imported.
void
setRequiresImport (bool Req)
void
addExtraDiagnostic (PartialDiagnostic PD)
Extra diagnostics are printed after the first diagnostic for the typo.
ArrayRef < PartialDiagnostic >
getExtraDiagnostics () const
Simple class containing the result of [Sema::CorrectTypo](classclang%5F1%5F1Sema.html#a6120561015b463e46bc6e299de250c6f "Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...").
Definition at line 42 of file TypoCorrection.h .
◆ const_decl_iterator◆ decl_iterator◆ TypoCorrection() [2/4]◆ TypoCorrection() [3/4]◆ TypoCorrection() [4/4]
clang::TypoCorrection::TypoCorrection ( )
default
◆ addCorrectionDecl()
void TypoCorrection::addCorrectionDecl
(
NamedDecl *
CDecl
)
Extra diagnostics are printed after the first diagnostic for the typo.
This can be used to attach external notes to the diag.
Definition at line 253 of file TypoCorrection.h .
◆ begin() [1/2]◆ begin() [2/2]◆ ClearCorrectionDecls()
void clang::TypoCorrection::ClearCorrectionDecls ( )
inline
◆ end() [1/2]◆ end() [2/2]◆ getAsString()
std::string TypoCorrection::getAsString
(
const LangOptions &
LO
)
const
◆ getCorrection()◆ getCorrectionAsIdentifierInfo()
IdentifierInfo * clang::TypoCorrection::getCorrectionAsIdentifierInfo ( ) const
inline
◆ getCorrectionDecl()
NamedDecl * clang::TypoCorrection::getCorrectionDecl ( ) const
inline
◆ getCorrectionDeclAs()template
DeclClass * clang::TypoCorrection::getCorrectionDeclAs ( ) const
inline
◆ getCorrectionRange()
SourceRange clang::TypoCorrection::getCorrectionRange ( ) const
inline
◆ getCorrectionSpecifier()◆ getEditDistance()
unsigned clang::TypoCorrection::getEditDistance ( bool Normalized = true ) const
inline
◆ getFoundDecl()
NamedDecl * clang::TypoCorrection::getFoundDecl ( ) const
inline
◆ getQuoted()
std::string clang::TypoCorrection::getQuoted ( const LangOptions & LO ) const
inline
◆ isKeyword() [1/2]
bool clang::TypoCorrection::isKeyword ( ) const
inline
◆ isKeyword() [2/2]template<std::size_t StrLen>
bool clang::TypoCorrection::isKeyword ( const char(&) _Str_[StrLen]) const
inline
◆ isOverloaded()
bool clang::TypoCorrection::isOverloaded ( ) const
inline
◆ isResolved()
bool clang::TypoCorrection::isResolved ( ) const
inline
◆ makeKeyword()
void clang::TypoCorrection::makeKeyword ( )
inline
Mark this TypoCorrection as being a keyword.
Since addCorrectionDeclsand setCorrectionDecl don't allow NULL to be added to the list of the correction's NamedDecl pointers, NULL is added as the only element in the list to mark this TypoCorrection as a keyword.
Definition at line 194 of file TypoCorrection.h .
◆ NormalizeEditDistance()
static unsigned clang::TypoCorrection::NormalizeEditDistance ( unsigned ED )
inlinestatic
◆ operator bool()
clang::TypoCorrection::operator bool ( ) const
inlineexplicit
◆ requiresImport()
bool clang::TypoCorrection::requiresImport ( ) const
inline
◆ setCallbackDistance()
void clang::TypoCorrection::setCallbackDistance ( unsigned ED )
inline
◆ setCorrectionDecl()
void clang::TypoCorrection::setCorrectionDecl ( NamedDecl * CDecl )
inline
◆ setCorrectionDecls()
void clang::TypoCorrection::setCorrectionDecls ( ArrayRef < NamedDecl * > Decls )
inline
◆ setCorrectionRange()◆ setCorrectionSpecifier()◆ setQualifierDistance()
void clang::TypoCorrection::setQualifierDistance ( unsigned ED )
inline
◆ setRequiresImport()
void clang::TypoCorrection::setRequiresImport ( bool Req )
inline
◆ WillReplaceSpecifier() [1/2]
bool clang::TypoCorrection::WillReplaceSpecifier ( ) const
inline
◆ WillReplaceSpecifier() [2/2]
void clang::TypoCorrection::WillReplaceSpecifier ( bool ForceReplacement )
inline
◆ CallbackDistanceWeight
const unsigned clang::TypoCorrection::CallbackDistanceWeight = 150U
static
◆ CharDistanceWeight
const unsigned clang::TypoCorrection::CharDistanceWeight = 100U
static
◆ InvalidDistance◆ MaximumDistance
const unsigned clang::TypoCorrection::MaximumDistance = 10000U
static
◆ QualifierDistanceWeight
const unsigned clang::TypoCorrection::QualifierDistanceWeight = 110U
static
The documentation for this class was generated from the following files: