// It is possible for enums to be created as part of their own
// declcontext. We need to cache a placeholder to avoid the type being
// created twice before hitting the cache.
- llvm::DIScope *EDContext = DBuilder.createReplaceableCompositeType(
+ llvm::DIScope *TmpContext = DBuilder.createReplaceableCompositeType(
llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0);
unsigned Line = getLineNumber(ED->getLocation());
StringRef EDName = ED->getName();
llvm::DIType *RetTy = DBuilder.createReplaceableCompositeType(
- llvm::dwarf::DW_TAG_enumeration_type, EDName, EDContext, DefUnit, Line,
+ llvm::dwarf::DW_TAG_enumeration_type, EDName, TmpContext, DefUnit, Line,
0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
// Cache the enum type so it is available when building the declcontext
// and replace the declcontect with the real thing.
TypeCache[Ty].reset(RetTy);
- EDContext->replaceAllUsesWith(getDeclContextDescriptor(ED));
+ TmpContext->replaceAllUsesWith(getDeclContextDescriptor(ED));
+ llvm::MDNode::deleteTemporary(TmpContext);
ReplaceMap.emplace_back(
std::piecewise_construct, std::make_tuple(Ty),