diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-06-20 18:11:18 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-06-20 18:11:18 +0000 |
commit | 527e616722f45986883cbc20e4bbb5d1651e75f4 (patch) | |
tree | 5c7c75c187e9448f5e98282e79a26ad272ad81e2 /lib/CodeGen/CGDebugInfo.cpp | |
parent | 6f61ba2e57aac6fc76638addce18ed59137ab9c1 (diff) |
Don't circumvent the debug info type cache when emitting info for EnumConstantDecl.
CreateEnumType doesn't participate in caching so the descriptor for the enum
gets recomputed for every reference of an element of an enum, only to get
discarded when it gets turned into an MDNode.
No functionality change except performance.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158832 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 19ea18c4cb..2fdd7a3e56 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -2660,8 +2660,9 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, StringRef Name = VD->getName(); llvm::DIType Ty = getOrCreateType(VD->getType(), Unit); if (const EnumConstantDecl *ECD = dyn_cast<EnumConstantDecl>(VD)) { - if (const EnumDecl *ED = dyn_cast<EnumDecl>(ECD->getDeclContext())) - Ty = CreateEnumType(ED); + const EnumDecl *ED = cast<EnumDecl>(ECD->getDeclContext()); + assert(isa<EnumType>(ED->getTypeForDecl()) && "Enum without EnumType?"); + Ty = getOrCreateType(QualType(ED->getTypeForDecl(), 0), Unit); } // Do not use DIGlobalVariable for enums. if (Ty.getTag() == llvm::dwarf::DW_TAG_enumeration_type) |