diff options
author | Kaelyn Takata <rikka@google.com> | 2014-10-27 18:07:29 +0000 |
---|---|---|
committer | Kaelyn Takata <rikka@google.com> | 2014-10-27 18:07:29 +0000 |
commit | 07ccb0381ae81807ab0900d090dc7179b7440589 (patch) | |
tree | 4fe8e83efadbe7bcc4fe94317f00f9e46b6503d4 /lib/Sema/SemaDeclCXX.cpp | |
parent | ebbcfcf837f3aadc20f8b0c091fc2d6ca20c6d8f (diff) |
Pass around CorrectionCandidateCallbacks as unique_ptrs so
TypoCorrectionConsumer can keep the callback around as long as needed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220693 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index e6c9944d44..9adba66c41 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -2830,10 +2830,11 @@ Sema::BuildMemInitializer(Decl *ConstructorD, // If no results were found, try to correct typos. TypoCorrection Corr; - MemInitializerValidatorCCC Validator(ClassDecl); if (R.empty() && BaseType.isNull() && - (Corr = CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), S, &SS, - Validator, CTK_ErrorRecovery, ClassDecl))) { + (Corr = CorrectTypo( + R.getLookupNameInfo(), R.getLookupKind(), S, &SS, + llvm::make_unique<MemInitializerValidatorCCC>(ClassDecl), + CTK_ErrorRecovery, ClassDecl))) { if (FieldDecl *Member = Corr.getCorrectionDeclAs<FieldDecl>()) { // We have found a non-static data member with a similar // name to what was typed; complain and initialize that @@ -7264,12 +7265,11 @@ static bool TryNamespaceTypoCorrection(Sema &S, LookupResult &R, Scope *Sc, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident) { - NamespaceValidatorCCC Validator; R.clear(); - if (TypoCorrection Corrected = S.CorrectTypo(R.getLookupNameInfo(), - R.getLookupKind(), Sc, &SS, - Validator, - Sema::CTK_ErrorRecovery)) { + if (TypoCorrection Corrected = + S.CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), Sc, &SS, + llvm::make_unique<NamespaceValidatorCCC>(), + Sema::CTK_ErrorRecovery)) { if (DeclContext *DC = S.computeDeclContext(SS, false)) { std::string CorrectedStr(Corrected.getAsString(S.getLangOpts())); bool DroppedSpecifier = Corrected.WillReplaceSpecifier() && @@ -7895,11 +7895,12 @@ NamedDecl *Sema::BuildUsingDeclaration(Scope *S, AccessSpecifier AS, // Try to correct typos if possible. if (R.empty()) { - UsingValidatorCCC CCC(HasTypenameKeyword, IsInstantiation, SS.getScopeRep(), - dyn_cast<CXXRecordDecl>(CurContext)); - if (TypoCorrection Corrected = CorrectTypo(R.getLookupNameInfo(), - R.getLookupKind(), S, &SS, CCC, - CTK_ErrorRecovery)){ + if (TypoCorrection Corrected = CorrectTypo( + R.getLookupNameInfo(), R.getLookupKind(), S, &SS, + llvm::make_unique<UsingValidatorCCC>( + HasTypenameKeyword, IsInstantiation, SS.getScopeRep(), + dyn_cast<CXXRecordDecl>(CurContext)), + CTK_ErrorRecovery)) { // We reject any correction for which ND would be NULL. NamedDecl *ND = Corrected.getCorrectionDecl(); |