diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-06-29 19:27:42 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-06-29 19:27:42 +0000 |
| commit | c048c52734ec9ca4e58a7c2ebc5510e423f32ebe (patch) | |
| tree | f83ea656bcc9aeb1422b08d08291e0924c44fd96 /clang/lib/Sema | |
| parent | cccaad95847a4cfd024668de8e944e0dfcf28634 (diff) | |
| download | bcm5719-llvm-c048c52734ec9ca4e58a7c2ebc5510e423f32ebe.tar.gz bcm5719-llvm-c048c52734ec9ca4e58a7c2ebc5510e423f32ebe.zip | |
When typo correction produces a result that is not of the kind we're
looking for, reset the name within the LookupResult structure in
addition to clearing out the results. Fixes PR7508.
llvm-svn: 107197
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaCXXScopeSpec.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 7 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 3 |
4 files changed, 16 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp index c0ec9e997d1..42c346fbe83 100644 --- a/clang/lib/Sema/SemaCXXScopeSpec.cpp +++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp @@ -458,8 +458,10 @@ Sema::CXXScopeTy *Sema::BuildCXXNestedNameSpecifier(Scope *S, if (NamedDecl *ND = Found.getAsSingle<NamedDecl>()) Diag(ND->getLocation(), diag::note_previous_decl) << ND->getDeclName(); - } else + } else { Found.clear(); + Found.setLookupName(&II); + } } NamedDecl *SD = Found.getAsSingle<NamedDecl>(); diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index bf75773f6d0..63452f9cbc4 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -1139,6 +1139,7 @@ Sema::ActOnMemInitializer(DeclPtrTy ConstructorD, return true; R.clear(); + R.setLookupName(MemberOrBase); } } @@ -3516,6 +3517,9 @@ Sema::DeclPtrTy Sema::ActOnUsingDirective(Scope *S, << Corrected; NamespcName = Corrected.getAsIdentifierInfo(); + } else { + R.clear(); + R.setLookupName(NamespcName); } } } @@ -4240,6 +4244,9 @@ Sema::DeclPtrTy Sema::ActOnNamespaceAliasDef(Scope *S, << Corrected; Ident = Corrected.getAsIdentifierInfo(); + } else { + R.clear(); + R.setLookupName(Ident); } } diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index e5c8e973c53..ae16d57870f 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -2620,6 +2620,7 @@ LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R, return false; } else { R.clear(); + R.setLookupName(Name); } return false; @@ -3080,6 +3081,9 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr, IV->getNameAsString()); Diag(IV->getLocation(), diag::note_previous_decl) << IV->getDeclName(); + } else { + Res.clear(); + Res.setLookupName(Member); } } diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 735809f1854..7e5377ab9a9 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -258,7 +258,7 @@ void Sema::LookupTemplateName(LookupResult &Found, // If we did not find any names, attempt to correct any typos. DeclarationName Name = Found.getLookupName(); if (DeclarationName Corrected = CorrectTypo(Found, S, &SS, LookupCtx, - false, CTC_CXXCasts)) { + false, CTC_CXXCasts)) { FilterAcceptableTemplateNames(Context, Found); if (!Found.empty()) { if (LookupCtx) @@ -277,6 +277,7 @@ void Sema::LookupTemplateName(LookupResult &Found, } } else { Found.clear(); + Found.setLookupName(Name); } } |

