diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2010-05-19 09:39:06 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2010-05-19 09:39:06 +0000 |
commit | c3f984fa13364520f4a2c447d1d213db77db3309 (patch) | |
tree | a0f3699e3d4f69d89a2cbbf687e0454a67c09367 /lib/Sema/SemaLookup.cpp | |
parent | a89064aa4695d9a2fec24efcc74ca0e795aaa17c (diff) |
Provide a naming class for UnresolvedLookupExprs, even when occuring on
template names. We were completely missing naming classes for many unqualified
lookups, but this didn't trigger code paths that need it. This removes part of
an optimization that re-uses the template name lookup done by the parser to
determine if explicit template arguments actually form a template-id.
Unfortunately the technique for avoiding the duplicate lookup lost needed data
such as the class context in which the lookup succeeded.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104117 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 774a82b7c7..b25ecb1e06 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -665,6 +665,8 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) { // DeclContext *OutsideOfTemplateParamDC = 0; for (; S && !isNamespaceOrTranslationUnitScope(S); S = S->getParent()) { + DeclContext *Ctx = static_cast<DeclContext*>(S->getEntity()); + // Check whether the IdResolver has anything in this scope. bool Found = false; for (; I != IEnd && S->isDeclScope(DeclPtrTy::make(*I)); ++I) { @@ -675,10 +677,11 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) { } if (Found) { R.resolveKind(); + if (S->isClassScope()) + R.setNamingClass(dyn_cast<CXXRecordDecl>(Ctx)); return true; } - DeclContext *Ctx = static_cast<DeclContext*>(S->getEntity()); if (!Ctx && S->isTemplateParamScope() && OutsideOfTemplateParamDC && S->getParent() && !S->getParent()->isTemplateParamScope()) { // We've just searched the last template parameter scope and |