aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-23 16:25:07 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-23 16:25:07 +0000
commitd57a38ee02c285d69d05fed6df0d7406b2517888 (patch)
tree12befd6424148fe3c4164bc1aa2b8b794aeff862 /lib/Sema/SemaTemplateInstantiateDecl.cpp
parent63010a7f0f57a27a9735b5a75211c6d988be2074 (diff)
When instantiating a typedef of an anonymous tag type, note in the tag
declaration that this typedef gives the tag a name. Fixes a problem uncovered by Boost.GIL (Generic Image Library). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102180 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 10fe176148..fe60be062c 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -200,12 +200,22 @@ Decl *TemplateDeclInstantiator::VisitTypedefDecl(TypedefDecl *D) {
if (Invalid)
Typedef->setInvalidDecl();
+ if (const TagType *TT = DI->getType()->getAs<TagType>()) {
+ TagDecl *TD = TT->getDecl();
+
+ // If the TagDecl that the TypedefDecl points to is an anonymous decl
+ // keep track of the TypedefDecl.
+ if (!TD->getIdentifier() && !TD->getTypedefForAnonDecl())
+ TD->setTypedefForAnonDecl(Typedef);
+ }
+
if (TypedefDecl *Prev = D->getPreviousDeclaration()) {
NamedDecl *InstPrev = SemaRef.FindInstantiatedDecl(D->getLocation(), Prev,
TemplateArgs);
Typedef->setPreviousDeclaration(cast<TypedefDecl>(InstPrev));
}
+
Typedef->setAccess(D->getAccess());
Owner->addDecl(Typedef);