summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-06-20 18:11:18 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-06-20 18:11:18 +0000
commite6dcf106b2f7f3a8769eb710d7502fd7d7a350ed (patch)
treee427dd393a3ea13884e54a9d10220d0f96e114ae /clang/lib
parent833308d785e21ec1742953b59e3ef82f27b82130 (diff)
downloadbcm5719-llvm-e6dcf106b2f7f3a8769eb710d7502fd7d7a350ed.tar.gz
bcm5719-llvm-e6dcf106b2f7f3a8769eb710d7502fd7d7a350ed.zip
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. llvm-svn: 158832
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 19ea18c4cbc..2fdd7a3e568 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/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)
OpenPOWER on IntegriCloud