aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-05-19 21:07:14 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-05-19 21:07:14 +0000
commitbf1cbaf1b0ac9d967ff6abf27788cc98f0f5e7da (patch)
tree2713ba8459bb2f33d0cbcd89e2b77a3e0975d800 /lib/Sema/SemaExpr.cpp
parent8f43d52b46b600b2eb4e62550f7a6d7a78fd001b (diff)
Revert r104117, "Provide a naming class for UnresolvedLookupExprs, even when
occuring on..." which breaks some Objective-C code. Working on getting a test case... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104150 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 94aa6b09fe..5e1f21b4c3 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1077,12 +1077,17 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S,
// Perform the required lookup.
LookupResult R(*this, Name, NameLoc, LookupOrdinaryName);
if (TemplateArgs) {
- // Lookup the template name again to correctly establish the context in
- // which it was found. This is really unfortunate as we already did the
- // lookup to determine that it was a template name in the first place. If
- // this becomes a performance hit, we can work harder to preserve those
- // results until we get here but it's likely not worth it.
- LookupTemplateName(R, S, SS, QualType(), /*EnteringContext=*/false);
+ // Just re-use the lookup done by isTemplateName.
+ DecomposeTemplateName(R, Id);
+
+ // Re-derive the naming class.
+ if (SS.isSet()) {
+ NestedNameSpecifier *Qualifier
+ = static_cast<NestedNameSpecifier *>(SS.getScopeRep());
+ if (const Type *Ty = Qualifier->getAsType())
+ if (CXXRecordDecl *NamingClass = Ty->getAsCXXRecordDecl())
+ R.setNamingClass(NamingClass);
+ }
} else {
bool IvarLookupFollowUp = (!SS.isSet() && II && getCurMethodDecl());
LookupParsedName(R, S, &SS, !IvarLookupFollowUp);