r260002 - Add a missing call to MDNode::deleteTemporary().

Adrian Prantl via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 6 10:39:34 PST 2016


Author: adrian
Date: Sat Feb  6 12:39:34 2016
New Revision: 260002

URL: http://llvm.org/viewvc/llvm-project?rev=260002&view=rev
Log:
Add a missing call to MDNode::deleteTemporary().
Follow-up to r259975. Kudos to the ASAN bots!

<rdar://problem/24493203>

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=260002&r1=260001&r2=260002&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Sat Feb  6 12:39:34 2016
@@ -2056,19 +2056,20 @@ llvm::DIType *CGDebugInfo::CreateEnumTyp
     // 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),




More information about the cfe-commits mailing list