Author: adrian Date: Mon Feb 8 11:03:28 2016 New Revision: 260113 URL: http://llvm.org/viewvc/llvm-project?rev=260113&view=rev Log: Use llvm::TempDIScope instead of manually deleting a temporary MDNode.
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=260113&r1=260112&r2=260113&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Feb 8 11:03:28 2016 @@ -2056,20 +2056,19 @@ 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 *TmpContext = DBuilder.createReplaceableCompositeType( - llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0); + llvm::TempDIScope 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, TmpContext, DefUnit, Line, - 0, Size, Align, llvm::DINode::FlagFwdDecl, FullName); + llvm::dwarf::DW_TAG_enumeration_type, EDName, TmpContext.get(), 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); TmpContext->replaceAllUsesWith(getDeclContextDescriptor(ED)); - llvm::MDNode::deleteTemporary(TmpContext); ReplaceMap.emplace_back( std::piecewise_construct, std::make_tuple(Ty), _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits