diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-05-27 17:20:35 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-05-27 17:20:35 +0000 |
commit | 8dbc3c64965f99e48830885835b7d2fc26ec3cf5 (patch) | |
tree | f916a7fe8c5606efe1a4f6a58bc2a2f082436061 /lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 2bba76b0ec4c2f2134eebb1a2bbfe102f36c2f6e (diff) |
Enumeration declarations that were instantiated from an enumeration
within a template now have a link back to the enumeration from which
they were instantiated. This means that we can now find the
instantiation of an anonymous enumeration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72482 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index a5eb7793b8..41c1944b54 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -208,6 +208,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) { EnumDecl *Enum = EnumDecl::Create(SemaRef.Context, Owner, D->getLocation(), D->getIdentifier(), /*PrevDecl=*/0); + Enum->setInstantiationOfMemberEnum(D); Enum->setAccess(D->getAccess()); Owner->addDecl(SemaRef.Context, Enum); Enum->startDefinition(); @@ -648,7 +649,9 @@ static bool isInstantiationOf(ASTContext &Ctx, NamedDecl *D, Decl *Other) { return Ctx.getCanonicalDecl(Function->getInstantiatedFromMemberFunction()) == Ctx.getCanonicalDecl(D); - // FIXME: Need something similar to the above for EnumDecls. + if (EnumDecl *Enum = dyn_cast<EnumDecl>(Other)) + return Ctx.getCanonicalDecl(Enum->getInstantiatedFromMemberEnum()) + == Ctx.getCanonicalDecl(D); // FIXME: How can we find instantiations of anonymous unions? |