From: Benjamin Kramer Date: Wed, 20 Jun 2012 18:11:18 +0000 (+0000) Subject: Don't circumvent the debug info type cache when emitting info for EnumConstantDecl. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=527e616722f45986883cbc20e4bbb5d1651e75f4;p=clang 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 --- 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(VD)) { - if (const EnumDecl *ED = dyn_cast(ECD->getDeclContext())) - Ty = CreateEnumType(ED); + const EnumDecl *ED = cast(ECD->getDeclContext()); + assert(isa(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)