class CorrectionCandidateCallback
Declaration
class CorrectionCandidateCallback { /* full declaration omitted */ };
Description
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo correction.
Declared at: clang/include/clang/Sema/TypoCorrection.h:281
Member Variables
- public bool WantTypeSpecifiers = true
- public bool WantExpressionKeywords = true
- public bool WantCXXNamedCasts = true
- public bool WantFunctionLikeCasts = true
- public bool WantRemainingKeywords = true
- public bool WantObjCSuper = false
- public bool IsObjCIvarLookup = false
- public bool IsAddressOfOperand = false
- protected clang::IdentifierInfo* Typo
- protected clang::NestedNameSpecifier* TypoNNS
- public static const unsigned int InvalidDistance = TypoCorrection::InvalidDistance
Method Overview
- public CorrectionCandidateCallback(clang::IdentifierInfo * Typo = nullptr, clang::NestedNameSpecifier * TypoNNS = nullptr)
- protected bool MatchesTypo(const clang::TypoCorrection & candidate)
- public virtual unsigned int RankCandidate(const clang::TypoCorrection & candidate)
- public virtual bool ValidateCandidate(const clang::TypoCorrection & candidate)
- public virtual std::unique_ptr<CorrectionCandidateCallback> clone()
- public void setTypoNNS(clang::NestedNameSpecifier * NNS)
- public void setTypoName(clang::IdentifierInfo * II)
- public virtual ~CorrectionCandidateCallback()
Methods
¶CorrectionCandidateCallback(
clang::IdentifierInfo* Typo = nullptr,
clang::NestedNameSpecifier* TypoNNS = nullptr)
CorrectionCandidateCallback(
clang::IdentifierInfo* Typo = nullptr,
clang::NestedNameSpecifier* TypoNNS = nullptr)
Declared at: clang/include/clang/Sema/TypoCorrection.h:285
Parameters
- clang::IdentifierInfo* Typo = nullptr
- clang::NestedNameSpecifier* TypoNNS = nullptr
¶bool MatchesTypo(
const clang::TypoCorrection& candidate)
bool MatchesTypo(
const clang::TypoCorrection& candidate)
Declared at: clang/include/clang/Sema/TypoCorrection.h:340
Parameters
- const clang::TypoCorrection& candidate
¶virtual unsigned int RankCandidate(
const clang::TypoCorrection& candidate)
virtual unsigned int RankCandidate(
const clang::TypoCorrection& candidate)
Description
Method used by Sema::CorrectTypo to assign an "edit distance" rank to a candidate (where a lower value represents a better candidate), or returning InvalidDistance if the candidate is not at all viable. For validation callbacks that only need to determine if a candidate is viable, the default RankCandidate returns either 0 or InvalidDistance depending whether ValidateCandidate returns true or false.
Declared at: clang/include/clang/Sema/TypoCorrection.h:309
Parameters
- const clang::TypoCorrection& candidate
¶virtual bool ValidateCandidate(
const clang::TypoCorrection& candidate)
virtual bool ValidateCandidate(
const clang::TypoCorrection& candidate)
Description
Simple predicate used by the default RankCandidate to determine whether to return an edit distance of 0 or InvalidDistance. This can be overridden by validators that only need to determine if a candidate is viable, without ranking potentially viable candidates. Only ValidateCandidate or RankCandidate need to be overridden by a callback wishing to check the viability of correction candidates. The default predicate always returns true if the candidate is not a type name or keyword, true for types if WantTypeSpecifiers is true, and true for keywords if WantTypeSpecifiers, WantExpressionKeywords, WantCXXNamedCasts, WantRemainingKeywords, or WantObjCSuper is true.
Declared at: clang/include/clang/Sema/TypoCorrection.h:301
Parameters
- const clang::TypoCorrection& candidate
¶virtual std::unique_ptr<
CorrectionCandidateCallback>
clone()
virtual std::unique_ptr<
CorrectionCandidateCallback>
clone()
Description
Clone this CorrectionCandidateCallback. CorrectionCandidateCallbacks are initially stack-allocated. However in case where delayed typo-correction is done we need to move the callback to storage with a longer lifetime. Every class deriving from CorrectionCandidateCallback must implement this method.
Declared at: clang/include/clang/Sema/TypoCorrection.h:320
¶void setTypoNNS(clang::NestedNameSpecifier* NNS)
void setTypoNNS(clang::NestedNameSpecifier* NNS)
Declared at: clang/include/clang/Sema/TypoCorrection.h:323
Parameters
¶void setTypoName(clang::IdentifierInfo* II)
void setTypoName(clang::IdentifierInfo* II)
Declared at: clang/include/clang/Sema/TypoCorrection.h:322
Parameters
¶virtual ~CorrectionCandidateCallback()
virtual ~CorrectionCandidateCallback()
Declared at: clang/include/clang/Sema/TypoCorrection.h:289