clang  3.9.0
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
clang::CorrectionCandidateCallback Class Reference

Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo correction. More...

#include <TypoCorrection.h>

Inheritance diagram for clang::CorrectionCandidateCallback:
[legend]
Collaboration diagram for clang::CorrectionCandidateCallback:
[legend]

Public Member Functions

 CorrectionCandidateCallback (IdentifierInfo *Typo=nullptr, NestedNameSpecifier *TypoNNS=nullptr)
 
virtual ~CorrectionCandidateCallback ()
 
virtual bool ValidateCandidate (const TypoCorrection &candidate)
 Simple predicate used by the default RankCandidate to determine whether to return an edit distance of 0 or InvalidDistance. More...
 
virtual unsigned RankCandidate (const TypoCorrection &candidate)
 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. More...
 
void setTypoName (IdentifierInfo *II)
 
void setTypoNNS (NestedNameSpecifier *NNS)
 

Public Attributes

bool WantTypeSpecifiers
 
bool WantExpressionKeywords
 
bool WantCXXNamedCasts
 
bool WantFunctionLikeCasts
 
bool WantRemainingKeywords
 
bool WantObjCSuper
 
bool IsObjCIvarLookup
 
bool IsAddressOfOperand
 

Static Public Attributes

static const unsigned InvalidDistance = TypoCorrection::InvalidDistance
 

Protected Member Functions

bool MatchesTypo (const TypoCorrection &candidate)
 

Protected Attributes

IdentifierInfoTypo
 
NestedNameSpecifierTypoNNS
 

Detailed Description

Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo correction.

Definition at line 252 of file TypoCorrection.h.

Constructor & Destructor Documentation

clang::CorrectionCandidateCallback::CorrectionCandidateCallback ( IdentifierInfo Typo = nullptr,
NestedNameSpecifier TypoNNS = nullptr 
)
inlineexplicit

Definition at line 256 of file TypoCorrection.h.

virtual clang::CorrectionCandidateCallback::~CorrectionCandidateCallback ( )
inlinevirtual

Definition at line 264 of file TypoCorrection.h.

Member Function Documentation

bool clang::CorrectionCandidateCallback::MatchesTypo ( const TypoCorrection candidate)
inlineprotected
virtual unsigned clang::CorrectionCandidateCallback::RankCandidate ( const TypoCorrection candidate)
inlinevirtual

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.

Definition at line 284 of file TypoCorrection.h.

References InvalidDistance, MatchesTypo(), and ValidateCandidate().

Referenced by isCandidateViable().

void clang::CorrectionCandidateCallback::setTypoName ( IdentifierInfo II)
inline

Definition at line 290 of file TypoCorrection.h.

References Typo.

void clang::CorrectionCandidateCallback::setTypoNNS ( NestedNameSpecifier NNS)
inline

Definition at line 291 of file TypoCorrection.h.

References TypoNNS.

bool CorrectionCandidateCallback::ValidateCandidate ( const TypoCorrection candidate)
virtual

Simple predicate used by the default RankCandidate to determine whether to return an edit distance of 0 or InvalidDistance.

This can be overrided by validators that only need to determine if a candidate is viable, without ranking potentially viable candidates. Only ValidateCandidate or RankCandidate need to be overriden 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.

Reimplemented in clang::NoTypoCorrectionCCC, clang::FunctionCallFilterCCC, and clang::DeclFilterCCC< C >.

Definition at line 4834 of file SemaLookup.cpp.

References IsAddressOfOperand, clang::TypoCorrection::isKeyword(), clang::TypoCorrection::isResolved(), WantCXXNamedCasts, WantExpressionKeywords, WantObjCSuper, WantRemainingKeywords, and WantTypeSpecifiers.

Referenced by RankCandidate().

Member Data Documentation

const unsigned clang::CorrectionCandidateCallback::InvalidDistance = TypoCorrection::InvalidDistance
static

Definition at line 254 of file TypoCorrection.h.

Referenced by RankCandidate().

bool clang::CorrectionCandidateCallback::IsAddressOfOperand

Definition at line 305 of file TypoCorrection.h.

Referenced by ValidateCandidate().

bool clang::CorrectionCandidateCallback::IsObjCIvarLookup

Definition at line 304 of file TypoCorrection.h.

IdentifierInfo* clang::CorrectionCandidateCallback::Typo
protected

Definition at line 316 of file TypoCorrection.h.

Referenced by MatchesTypo(), and setTypoName().

NestedNameSpecifier* clang::CorrectionCandidateCallback::TypoNNS
protected

Definition at line 317 of file TypoCorrection.h.

Referenced by MatchesTypo(), and setTypoNNS().

bool clang::CorrectionCandidateCallback::WantCXXNamedCasts
bool clang::CorrectionCandidateCallback::WantExpressionKeywords
bool clang::CorrectionCandidateCallback::WantFunctionLikeCasts
bool clang::CorrectionCandidateCallback::WantObjCSuper

Definition at line 301 of file TypoCorrection.h.

Referenced by AddKeywordsToConsumer(), and ValidateCandidate().

bool clang::CorrectionCandidateCallback::WantRemainingKeywords
bool clang::CorrectionCandidateCallback::WantTypeSpecifiers

The documentation for this class was generated from the following files: