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
This commit is contained in:
Benjamin Kramer 2012-06-20 18:11:18 +00:00
parent 833308d785
commit e6dcf106b2
1 changed files with 3 additions and 2 deletions

View File

@ -2660,8 +2660,9 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD,
StringRef Name = VD->getName(); StringRef Name = VD->getName();
llvm::DIType Ty = getOrCreateType(VD->getType(), Unit); llvm::DIType Ty = getOrCreateType(VD->getType(), Unit);
if (const EnumConstantDecl *ECD = dyn_cast<EnumConstantDecl>(VD)) { if (const EnumConstantDecl *ECD = dyn_cast<EnumConstantDecl>(VD)) {
if (const EnumDecl *ED = dyn_cast<EnumDecl>(ECD->getDeclContext())) const EnumDecl *ED = cast<EnumDecl>(ECD->getDeclContext());
Ty = CreateEnumType(ED); assert(isa<EnumType>(ED->getTypeForDecl()) && "Enum without EnumType?");
Ty = getOrCreateType(QualType(ED->getTypeForDecl(), 0), Unit);
} }
// Do not use DIGlobalVariable for enums. // Do not use DIGlobalVariable for enums.
if (Ty.getTag() == llvm::dwarf::DW_TAG_enumeration_type) if (Ty.getTag() == llvm::dwarf::DW_TAG_enumeration_type)