summaryrefslogtreecommitdiffstats
path: root/clang/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
commit83eb5032c09db7b6d8e0909a2c2a5a36e9bbcff8 (patch)
tree9d3236ca6715a707a7ec4ed1858225ca89bf4b75 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
parent7a0ffdbe53d4a39cbcff1f1fcaf8703d2c5eb6c2 (diff)
downloadbcm5719-llvm-83eb5032c09db7b6d8e0909a2c2a5a36e9bbcff8.tar.gz
bcm5719-llvm-83eb5032c09db7b6d8e0909a2c2a5a36e9bbcff8.zip
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). llvm-svn: 102180
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 10fe176148f..fe60be062c1 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud