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

Methods

void ClearCorrectionDecls()

Description

Clears the list of NamedDecls.

Declared at: clang/include/clang/Sema/TypoCorrection.h:161

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)

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)

Declared at: clang/include/clang/Sema/TypoCorrection.h:76

Parameters

clang::DeclarationName Name
clang::NestedNameSpecifier* NNS = nullptr
unsigned int CharDistance = 0

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)

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)

Declared at: clang/include/clang/Sema/TypoCorrection.h:100

Parameters

bool ForceReplacement

bool WillReplaceSpecifier() const

Declared at: clang/include/clang/Sema/TypoCorrection.h:104

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)

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::PartialDiagnostic PD

clang::TypoCorrection::const_decl_iterator begin()
    const

Declared at: clang/include/clang/Sema/TypoCorrection.h:240

clang::TypoCorrection::decl_iterator begin()

Declared at: clang/include/clang/Sema/TypoCorrection.h:232

clang::TypoCorrection::const_decl_iterator end()
    const

Declared at: clang/include/clang/Sema/TypoCorrection.h:244

clang::TypoCorrection::decl_iterator end()

Declared at: clang/include/clang/Sema/TypoCorrection.h:236

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

Description

Gets the DeclarationName of the typo correction

Declared at: clang/include/clang/Sema/TypoCorrection.h:84

clang::IdentifierInfo*
getCorrectionAsIdentifierInfo() const

Declared at: clang/include/clang/Sema/TypoCorrection.h:86

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

Declared at: clang/include/clang/Sema/TypoCorrection.h:156

Templates

DeclClass

clang::SourceRange getCorrectionRange() const

Declared at: clang/include/clang/Sema/TypoCorrection.h:226

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

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

Declared at: clang/include/clang/Sema/TypoCorrection.h:256

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

Declared at: clang/include/clang/Sema/TypoCorrection.h:183

Parameters

const clang::LangOptions& LO

bool hasCorrectionDecl() const

Declared at: clang/include/clang/Sema/TypoCorrection.h:261

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

Declared at: clang/include/clang/Sema/TypoCorrection.h:202

bool isOverloaded() const

Declared at: clang/include/clang/Sema/TypoCorrection.h:215

bool isResolved() const

Declared at: clang/include/clang/Sema/TypoCorrection.h:213

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

Description

Returns whether this TypoCorrection has a non-empty DeclarationName

Declared at: clang/include/clang/Sema/TypoCorrection.h:188

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)

Declared at: clang/include/clang/Sema/TypoCorrection.h:112

Parameters

unsigned int ED

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)

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)

Declared at: clang/include/clang/Sema/TypoCorrection.h:219

Parameters

clang::CXXScopeSpec* SS
const clang::DeclarationNameInfo& TypoName

void setCorrectionSpecifier(
    clang::NestedNameSpecifier* NNS)

Declared at: clang/include/clang/Sema/TypoCorrection.h:95

Parameters

clang::NestedNameSpecifier* NNS

void setQualifierDistance(unsigned int ED)

Declared at: clang/include/clang/Sema/TypoCorrection.h:108

Parameters

unsigned int ED

void setRequiresImport(bool Req)

Declared at: clang/include/clang/Sema/TypoCorrection.h:249

Parameters

bool Req