aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
authorKaelyn Uhrain <rikka@google.com>2012-01-31 23:49:25 +0000
committerKaelyn Uhrain <rikka@google.com>2012-01-31 23:49:25 +0000
commit16e46dd0c284296cea819dfbf67942ecef02894d (patch)
treeeb74d6a94e34e33abe288918159f958afb4e460f /lib/Sema/SemaLookup.cpp
parent4ac38094a1844166ac455004bf94d0aaf1e2df74 (diff)
Make the callback object to Sema::CorrectTypo mandatory.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149451 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r--lib/Sema/SemaLookup.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index 23ecb25090..f2185157ad 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -3536,7 +3536,7 @@ static void AddKeywordsToConsumer(Sema &SemaRef,
TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
Sema::LookupNameKind LookupKind,
Scope *S, CXXScopeSpec *SS,
- CorrectionCandidateCallback *CCC,
+ CorrectionCandidateCallback &CCC,
DeclContext *MemberContext,
bool EnteringContext,
const ObjCObjectPointerType *OPT) {
@@ -3572,7 +3572,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
// If a callback object returns true for an empty typo correction candidate,
// assume it does not do any actual validation of the candidates.
TypoCorrection EmptyCorrection;
- bool ValidatingCallback = CCC && !CCC->ValidateCandidate(EmptyCorrection);
+ bool ValidatingCallback = !CCC.ValidateCandidate(EmptyCorrection);
// Perform name lookup to find visible, similarly-named entities.
bool IsUnqualifiedLookup = false;
@@ -3608,7 +3608,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
// keyword case, we'll end up adding the keyword below.
if (Cached->second) {
if (!Cached->second.isKeyword() &&
- (!CCC || CCC->ValidateCandidate(Cached->second)))
+ CCC.ValidateCandidate(Cached->second))
Consumer.addCorrection(Cached->second);
} else {
// Only honor no-correction cache hits when a callback that will validate
@@ -3646,8 +3646,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
}
}
- CorrectionCandidateCallback DefaultCCC;
- AddKeywordsToConsumer(*this, Consumer, S, CCC ? *CCC : DefaultCCC);
+ AddKeywordsToConsumer(*this, Consumer, S, CCC);
// If we haven't found anything, we're done.
if (Consumer.empty()) {
@@ -3704,7 +3703,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
if (I->second.isResolved()) {
TypoCorrectionConsumer::result_iterator Prev = I;
++I;
- if (CCC && !CCC->ValidateCandidate(Prev->second))
+ if (!CCC.ValidateCandidate(Prev->second))
DI->second->erase(Prev);
continue;
}
@@ -3712,7 +3711,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
// Perform name lookup on this name.
IdentifierInfo *Name = I->second.getCorrectionAsIdentifierInfo();
LookupPotentialTypoResult(*this, TmpRes, Name, S, SS, MemberContext,
- EnteringContext, CCC && CCC->IsObjCIvarLookup);
+ EnteringContext, CCC.IsObjCIvarLookup);
switch (TmpRes.getResultKind()) {
case LookupResult::NotFound:
@@ -3741,7 +3740,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
TRD != TRDEnd; ++TRD)
I->second.addCorrectionDecl(*TRD);
++I;
- if (CCC && !CCC->ValidateCandidate(Prev->second))
+ if (!CCC.ValidateCandidate(Prev->second))
DI->second->erase(Prev);
break;
}
@@ -3750,7 +3749,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
TypoCorrectionConsumer::result_iterator Prev = I;
I->second.setCorrectionDecl(TmpRes.getAsSingle<NamedDecl>());
++I;
- if (CCC && !CCC->ValidateCandidate(Prev->second))
+ if (!CCC.ValidateCandidate(Prev->second))
DI->second->erase(Prev);
break;
}
@@ -3868,7 +3867,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
// WantObjCSuper is only true for CTC_ObjCMessageReceiver and for
// some instances of CTC_Unknown, while WantRemainingKeywords is true
// for CTC_Unknown but not for CTC_ObjCMessageReceiver.
- && CCC && CCC->WantObjCSuper && !CCC->WantRemainingKeywords
+ && CCC.WantObjCSuper && !CCC.WantRemainingKeywords
&& BestResults["super"].isKeyword()) {
// Prefer 'super' when we're completing in a message-receiver
// context.