summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-12-21 21:22:51 +0000
committerDouglas Gregor <dgregor@apple.com>2010-12-21 21:22:51 +0000
commite9fc8dc84c4da2e9aea44c6e1a7bcc2af99d91c2 (patch)
treed31e8804755d7370a528825b2ee538840866bec4 /clang/lib
parent87c47499c6e2e5c3b6c0bac04ce9e6782bf6059c (diff)
downloadbcm5719-llvm-e9fc8dc84c4da2e9aea44c6e1a7bcc2af99d91c2.tar.gz
bcm5719-llvm-e9fc8dc84c4da2e9aea44c6e1a7bcc2af99d91c2.zip
When searching for the instantiation of a locally-scoped tag
declaration, also look for an instantiation of its previous declarations. Fixes PR8801. llvm-svn: 122361
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiate.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 37d8d8cb53d..2fa4ac5b0b2 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1735,11 +1735,21 @@ Decl *LocalInstantiationScope::getInstantiationOf(const Decl *D) {
for (LocalInstantiationScope *Current = this; Current;
Current = Current->Outer) {
// Check if we found something within this scope.
- llvm::DenseMap<const Decl *, Decl *>::iterator Found
- = Current->LocalDecls.find(D);
- if (Found != Current->LocalDecls.end())
- return Found->second;
-
+ const Decl *CheckD = D;
+ do {
+ llvm::DenseMap<const Decl *, Decl *>::iterator Found
+ = Current->LocalDecls.find(CheckD);
+ if (Found != Current->LocalDecls.end())
+ return Found->second;
+
+ // If this is a tag declaration, it's possible that we need to look for
+ // a previous declaration.
+ if (const TagDecl *Tag = dyn_cast<TagDecl>(CheckD))
+ CheckD = Tag->getPreviousDeclaration();
+ else
+ CheckD = 0;
+ } while (CheckD);
+
// If we aren't combined with our outer scope, we're done.
if (!Current->CombineWithOuterScope)
break;
OpenPOWER on IntegriCloud