class TypoCorrection
Declaration
class TypoCorrection { /* full declaration omitted */ };
Description
Simple class containing the result of Sema::CorrectTypo
Declared at: clang/include/clang/Sema/TypoCorrection.h:42
Member Variables
- private clang::DeclarationName CorrectionName
- private clang::NestedNameSpecifier* CorrectionNameSpec = nullptr
- private SmallVector<clang::NamedDecl*, 1> CorrectionDecls
- private unsigned int CharDistance = 0
- private unsigned int QualifierDistance = 0
- private unsigned int CallbackDistance = 0
- private clang::SourceRange CorrectionRange
- private bool ForceSpecifierReplacement = false
- private bool RequiresImport = false
- private std::vector<PartialDiagnostic> ExtraDiagnostics
- public static const unsigned int InvalidDistance = std::numeric_limits<unsigned int>::max()
- public static const unsigned int MaximumDistance = 10000U
- public static const unsigned int CharDistanceWeight = 100U
- public static const unsigned int QualifierDistanceWeight = 110U
- public static const unsigned int CallbackDistanceWeight = 150U
Method Overview
- public void ClearCorrectionDecls()
- public static unsigned int NormalizeEditDistance(unsigned int ED)
- public TypoCorrection(clang::NamedDecl * Name, clang::NestedNameSpecifier * NNS = nullptr, unsigned int CharDistance = 0)
- public TypoCorrection(clang::DeclarationName Name, clang::NestedNameSpecifier * NNS = nullptr, unsigned int CharDistance = 0)
- public TypoCorrection()
- public TypoCorrection(const clang::DeclarationName & Name, clang::NamedDecl * NameDecl, clang::NestedNameSpecifier * NNS = nullptr, unsigned int CharDistance = 0, unsigned int QualifierDistance = 0)
- public void WillReplaceSpecifier(bool ForceReplacement)
- public bool WillReplaceSpecifier() const
- public void addCorrectionDecl(clang::NamedDecl * CDecl)
- public void addExtraDiagnostic(clang::PartialDiagnostic PD)
- public clang::TypoCorrection::const_decl_iterator begin() const
- public clang::TypoCorrection::decl_iterator begin()
- public clang::TypoCorrection::const_decl_iterator end() const
- public clang::TypoCorrection::decl_iterator end()
- public std::string getAsString(const clang::LangOptions & LO) const
- public clang::DeclarationName getCorrection() const
- public clang::IdentifierInfo * getCorrectionAsIdentifierInfo() const
- public clang::NamedDecl * getCorrectionDecl() const
- public template <class DeclClass>DeclClass * getCorrectionDeclAs() const
- public clang::SourceRange getCorrectionRange() const
- public clang::NestedNameSpecifier * getCorrectionSpecifier() const
- public unsigned int getEditDistance(bool Normalized = true) const
- public ArrayRef<clang::PartialDiagnostic> getExtraDiagnostics() const
- public clang::NamedDecl * getFoundDecl() const
- public std::string getQuoted(const clang::LangOptions & LO) const
- private bool hasCorrectionDecl() const
- public template <std::size_t StrLen>bool isKeyword(const char (&)[StrLen] Str) const
- public bool isKeyword() const
- public bool isOverloaded() const
- public bool isResolved() const
- public void makeKeyword()
- public bool operator bool() const
- public bool requiresImport() const
- public void setCallbackDistance(unsigned int ED)
- public void setCorrectionDecl(clang::NamedDecl * CDecl)
- public void setCorrectionDecls(ArrayRef<clang::NamedDecl *> Decls)
- public void setCorrectionRange(clang::CXXScopeSpec * SS, const clang::DeclarationNameInfo & TypoName)
- public void setCorrectionSpecifier(clang::NestedNameSpecifier * NNS)
- public void setQualifierDistance(unsigned int ED)
- public void setRequiresImport(bool Req)
Methods
¶void ClearCorrectionDecls()
void ClearCorrectionDecls()
Description
Clears the list of NamedDecls.
Declared at: clang/include/clang/Sema/TypoCorrection.h:161
¶static unsigned int NormalizeEditDistance(
unsigned int ED)
static unsigned int NormalizeEditDistance(
unsigned int ED)
Declared at: clang/include/clang/Sema/TypoCorrection.h:119
Parameters
- unsigned int ED
¶TypoCorrection(
clang::NamedDecl* Name,
clang::NestedNameSpecifier* NNS = nullptr,
unsigned int CharDistance = 0)
TypoCorrection(
clang::NamedDecl* Name,
clang::NestedNameSpecifier* NNS = nullptr,
unsigned int CharDistance = 0)
Declared at: clang/include/clang/Sema/TypoCorrection.h:68
Parameters
- clang::NamedDecl* Name
- clang::NestedNameSpecifier* NNS = nullptr
- unsigned int CharDistance = 0
¶TypoCorrection(
clang::DeclarationName Name,
clang::NestedNameSpecifier* NNS = nullptr,
unsigned int CharDistance = 0)
TypoCorrection(
clang::DeclarationName Name,
clang::NestedNameSpecifier* NNS = nullptr,
unsigned int CharDistance = 0)
Declared at: clang/include/clang/Sema/TypoCorrection.h:76
Parameters
- clang::DeclarationName Name
- clang::NestedNameSpecifier* NNS = nullptr
- unsigned int CharDistance = 0
¶TypoCorrection()
TypoCorrection()
Declared at: clang/include/clang/Sema/TypoCorrection.h:81
¶TypoCorrection(
const clang::DeclarationName& Name,
clang::NamedDecl* NameDecl,
clang::NestedNameSpecifier* NNS = nullptr,
unsigned int CharDistance = 0,
unsigned int QualifierDistance = 0)
TypoCorrection(
const clang::DeclarationName& Name,
clang::NamedDecl* NameDecl,
clang::NestedNameSpecifier* NNS = nullptr,
unsigned int CharDistance = 0,
unsigned int QualifierDistance = 0)
Declared at: clang/include/clang/Sema/TypoCorrection.h:59
Parameters
- const clang::DeclarationName& Name
- clang::NamedDecl* NameDecl
- clang::NestedNameSpecifier* NNS = nullptr
- unsigned int CharDistance = 0
- unsigned int QualifierDistance = 0
¶void WillReplaceSpecifier(bool ForceReplacement)
void WillReplaceSpecifier(bool ForceReplacement)
Declared at: clang/include/clang/Sema/TypoCorrection.h:100
Parameters
- bool ForceReplacement
¶bool WillReplaceSpecifier() const
bool WillReplaceSpecifier() const
Declared at: clang/include/clang/Sema/TypoCorrection.h:104
¶void addCorrectionDecl(clang::NamedDecl* CDecl)
void addCorrectionDecl(clang::NamedDecl* CDecl)
Description
Add the given NamedDecl to the list of NamedDecls that are the declarations associated with the DeclarationName of this TypoCorrection
Declared at: clang/include/clang/Sema/TypoCorrection.h:179
Parameters
- clang::NamedDecl* CDecl
¶void addExtraDiagnostic(
clang::PartialDiagnostic PD)
void addExtraDiagnostic(
clang::PartialDiagnostic PD)
Description
Extra diagnostics are printed after the first diagnostic for the typo. This can be used to attach external notes to the diag.
Declared at: clang/include/clang/Sema/TypoCorrection.h:253
Parameters
¶clang::TypoCorrection::const_decl_iterator begin()
const
clang::TypoCorrection::const_decl_iterator begin()
const
Declared at: clang/include/clang/Sema/TypoCorrection.h:240
¶clang::TypoCorrection::decl_iterator begin()
clang::TypoCorrection::decl_iterator begin()
Declared at: clang/include/clang/Sema/TypoCorrection.h:232
¶clang::TypoCorrection::const_decl_iterator end()
const
clang::TypoCorrection::const_decl_iterator end()
const
Declared at: clang/include/clang/Sema/TypoCorrection.h:244
¶clang::TypoCorrection::decl_iterator end()
clang::TypoCorrection::decl_iterator end()
Declared at: clang/include/clang/Sema/TypoCorrection.h:236
¶std::string getAsString(
const clang::LangOptions& LO) const
std::string getAsString(
const clang::LangOptions& LO) const
Declared at: clang/include/clang/Sema/TypoCorrection.h:181
Parameters
- const clang::LangOptions& LO
¶clang::DeclarationName getCorrection() const
clang::DeclarationName getCorrection() const
Description
Gets the DeclarationName of the typo correction
Declared at: clang/include/clang/Sema/TypoCorrection.h:84
¶clang::IdentifierInfo*
getCorrectionAsIdentifierInfo() const
clang::IdentifierInfo*
getCorrectionAsIdentifierInfo() const
Declared at: clang/include/clang/Sema/TypoCorrection.h:86
¶clang::NamedDecl* getCorrectionDecl() const
clang::NamedDecl* getCorrectionDecl() const
Description
Gets the pointer to the declaration of the typo correction
Declared at: clang/include/clang/Sema/TypoCorrection.h:151
¶template <class DeclClass>
DeclClass* getCorrectionDeclAs() const
template <class DeclClass>
DeclClass* getCorrectionDeclAs() const
Declared at: clang/include/clang/Sema/TypoCorrection.h:156
Templates
- DeclClass
¶clang::SourceRange getCorrectionRange() const
clang::SourceRange getCorrectionRange() const
Declared at: clang/include/clang/Sema/TypoCorrection.h:226
¶clang::NestedNameSpecifier*
getCorrectionSpecifier() const
clang::NestedNameSpecifier*
getCorrectionSpecifier() const
Description
Gets the NestedNameSpecifier needed to use the typo correction
Declared at: clang/include/clang/Sema/TypoCorrection.h:91
¶unsigned int getEditDistance(
bool Normalized = true) const
unsigned int getEditDistance(
bool Normalized = true) const
Description
Gets the "edit distance" of the typo correction from the typo. If Normalized is true, scale the distance down by the CharDistanceWeight to return the edit distance in terms of single-character edits.
Declared at: clang/include/clang/Sema/TypoCorrection.h:128
Parameters
- bool Normalized = true
¶ArrayRef<clang::PartialDiagnostic>
getExtraDiagnostics() const
ArrayRef<clang::PartialDiagnostic>
getExtraDiagnostics() const
Declared at: clang/include/clang/Sema/TypoCorrection.h:256
¶clang::NamedDecl* getFoundDecl() const
clang::NamedDecl* getFoundDecl() const
Description
Get the correction declaration found by name lookup (before we looked through using shadow declarations and the like).
Declared at: clang/include/clang/Sema/TypoCorrection.h:146
¶std::string getQuoted(
const clang::LangOptions& LO) const
std::string getQuoted(
const clang::LangOptions& LO) const
Declared at: clang/include/clang/Sema/TypoCorrection.h:183
Parameters
- const clang::LangOptions& LO
¶bool hasCorrectionDecl() const
bool hasCorrectionDecl() const
Declared at: clang/include/clang/Sema/TypoCorrection.h:261
¶template <std::size_t StrLen>
bool isKeyword(const char (&)[StrLen] Str) const
template <std::size_t StrLen>
bool isKeyword(const char (&)[StrLen] Str) const
Declared at: clang/include/clang/Sema/TypoCorrection.h:208
Templates
- std::size_t StrLen
Parameters
- const char (&)[StrLen] Str
¶bool isKeyword() const
bool isKeyword() const
Declared at: clang/include/clang/Sema/TypoCorrection.h:202
¶bool isOverloaded() const
bool isOverloaded() const
Declared at: clang/include/clang/Sema/TypoCorrection.h:215
¶bool isResolved() const
bool isResolved() const
Declared at: clang/include/clang/Sema/TypoCorrection.h:213
¶void makeKeyword()
void makeKeyword()
Description
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.
Declared at: clang/include/clang/Sema/TypoCorrection.h:194
¶bool operator bool() const
bool operator bool() const
Description
Returns whether this TypoCorrection has a non-empty DeclarationName
Declared at: clang/include/clang/Sema/TypoCorrection.h:188
¶bool requiresImport() const
bool requiresImport() const
Description
Returns whether this typo correction is correcting to a declaration that was declared in a module that has not been imported.
Declared at: clang/include/clang/Sema/TypoCorrection.h:248
¶void setCallbackDistance(unsigned int ED)
void setCallbackDistance(unsigned int ED)
Declared at: clang/include/clang/Sema/TypoCorrection.h:112
Parameters
- unsigned int ED
¶void setCorrectionDecl(clang::NamedDecl* CDecl)
void setCorrectionDecl(clang::NamedDecl* CDecl)
Description
Clears the list of NamedDecls before adding the new one.
Declared at: clang/include/clang/Sema/TypoCorrection.h:166
Parameters
- clang::NamedDecl* CDecl
¶void setCorrectionDecls(
ArrayRef<clang::NamedDecl*> Decls)
void setCorrectionDecls(
ArrayRef<clang::NamedDecl*> Decls)
Description
Clears the list of NamedDecls and adds the given set.
Declared at: clang/include/clang/Sema/TypoCorrection.h:172
Parameters
- ArrayRef<clang::NamedDecl*> Decls
¶void setCorrectionRange(
clang::CXXScopeSpec* SS,
const clang::DeclarationNameInfo& TypoName)
void setCorrectionRange(
clang::CXXScopeSpec* SS,
const clang::DeclarationNameInfo& TypoName)
Declared at: clang/include/clang/Sema/TypoCorrection.h:219
Parameters
- clang::CXXScopeSpec* SS
- const clang::DeclarationNameInfo& TypoName
¶void setCorrectionSpecifier(
clang::NestedNameSpecifier* NNS)
void setCorrectionSpecifier(
clang::NestedNameSpecifier* NNS)
Declared at: clang/include/clang/Sema/TypoCorrection.h:95
Parameters
¶void setQualifierDistance(unsigned int ED)
void setQualifierDistance(unsigned int ED)
Declared at: clang/include/clang/Sema/TypoCorrection.h:108
Parameters
- unsigned int ED
¶void setRequiresImport(bool Req)
void setRequiresImport(bool Req)
Declared at: clang/include/clang/Sema/TypoCorrection.h:249
Parameters
- bool Req