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 | 89c881b548753639e4abf8a6edf30edf22190275 (patch) | |
| tree | 278309f84e85ce671e0f18e9901c67b3cb79fb0c /clang/lib/Sema/SemaTemplate.cpp | |
| parent | e1f49d545dbbf02c77dc297551101eab58cb2485 (diff) | |
| download | bcm5719-llvm-89c881b548753639e4abf8a6edf30edf22190275.tar.gz bcm5719-llvm-89c881b548753639e4abf8a6edf30edf22190275.zip | |
Pass around CorrectionCandidateCallbacks as unique_ptrs so
TypoCorrectionConsumer can keep the callback around as long as needed.
llvm-svn: 220693
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 428f24fd2da..42b42a57034 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -318,15 +318,14 @@ void Sema::LookupTemplateName(LookupResult &Found, DeclarationName Name = Found.getLookupName(); Found.clear(); // Simple filter callback that, for keywords, only accepts the C++ *_cast - CorrectionCandidateCallback FilterCCC; - FilterCCC.WantTypeSpecifiers = false; - FilterCCC.WantExpressionKeywords = false; - FilterCCC.WantRemainingKeywords = false; - FilterCCC.WantCXXNamedCasts = true; - if (TypoCorrection Corrected = CorrectTypo(Found.getLookupNameInfo(), - Found.getLookupKind(), S, &SS, - FilterCCC, CTK_ErrorRecovery, - LookupCtx)) { + auto FilterCCC = llvm::make_unique<CorrectionCandidateCallback>(); + FilterCCC->WantTypeSpecifiers = false; + FilterCCC->WantExpressionKeywords = false; + FilterCCC->WantRemainingKeywords = false; + FilterCCC->WantCXXNamedCasts = true; + if (TypoCorrection Corrected = CorrectTypo( + Found.getLookupNameInfo(), Found.getLookupKind(), S, &SS, + std::move(FilterCCC), CTK_ErrorRecovery, LookupCtx)) { Found.setLookupName(Corrected.getCorrection()); if (Corrected.getCorrectionDecl()) Found.addDecl(Corrected.getCorrectionDecl()); |

