diff options
author | Kaelyn Uhrain <rikka@google.com> | 2013-04-03 16:59:49 +0000 |
---|---|---|
committer | Kaelyn Uhrain <rikka@google.com> | 2013-04-03 16:59:49 +0000 |
commit | 20a7cf4d782e32b2752e651a11ed3712d2debd65 (patch) | |
tree | 6508fae972481d70cb0a7a296ff79060e2204fa7 /include/clang/Sema/TypoCorrection.h | |
parent | 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05 (diff) |
Give the default CorrectionCandidateCallback::ValidateCandidate some
smarts so that it doesn't approve of keywords and/or type names when it
knows (based on its flags) that those kinds of corrections are not
wanted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178668 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Sema/TypoCorrection.h')
-rw-r--r-- | include/clang/Sema/TypoCorrection.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/clang/Sema/TypoCorrection.h b/include/clang/Sema/TypoCorrection.h index 0b897b55cc..cdd71c8fa9 100644 --- a/include/clang/Sema/TypoCorrection.h +++ b/include/clang/Sema/TypoCorrection.h @@ -228,9 +228,11 @@ class CorrectionCandidateCallback { /// 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. - virtual bool ValidateCandidate(const TypoCorrection &candidate) { - return true; - } + /// 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. + virtual bool ValidateCandidate(const TypoCorrection &candidate); /// \brief Method used by Sema::CorrectTypo to assign an "edit distance" rank /// to a candidate (where a lower value represents a better candidate), or |