struct TemplateCandidateFilter

Declaration

struct TemplateCandidateFilter : public 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/lib/Sema/SemaTemplate.cpp:670

Inherits from: CorrectionCandidateCallback

Member Variables

public clang::Sema& S

Inherited from CorrectionCandidateCallback:

public WantTypeSpecifiers = true
public WantExpressionKeywords = true
public WantCXXNamedCasts = true
public WantFunctionLikeCasts = true
public WantRemainingKeywords = true
public WantObjCSuper = false
public IsObjCIvarLookup = false
public IsAddressOfOperand = false
protected Typo
protected TypoNNS
public static InvalidDistance = TypoCorrection::InvalidDistance

Method Overview

Inherited from CorrectionCandidateCallback:

Methods

TemplateCandidateFilter(clang::Sema& S)

Declared at: clang/lib/Sema/SemaTemplate.cpp:672

Parameters

clang::Sema& S

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/lib/Sema/SemaTemplate.cpp:678

Parameters

const clang::TypoCorrection& Candidate

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/lib/Sema/SemaTemplate.cpp:684