From: Adrian Prantl Date: Sat, 6 Feb 2016 18:39:34 +0000 (+0000) Subject: Add a missing call to MDNode::deleteTemporary(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4404328870f6e3758e5d4d357442b39298f4e8f7;p=clang Add a missing call to MDNode::deleteTemporary(). Follow-up to r259975. Kudos to the ASAN bots! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260002 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 34dcea1126..3da0765d37 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -2056,19 +2056,20 @@ llvm::DIType *CGDebugInfo::CreateEnumType(const EnumType *Ty) { // 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),