From 594bf484e451b221368d7b4184099163baca9fb2 Mon Sep 17 00:00:00 2001 From: Frederic Riss Date: Thu, 20 Nov 2014 15:52:34 +0000 Subject: [PATCH] Do not create a replaceable Variables MDNode for function forward decls. These fields would need to be explicitly deleted before we RAUW the temporary node anyway (this was done in cfe commit r222373). Instead, do not create these useless nodes in the first place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222434 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/DIBuilder.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp index 204817f84e8..4fe2be61b8f 100644 --- a/lib/IR/DIBuilder.cpp +++ b/lib/IR/DIBuilder.cpp @@ -937,11 +937,10 @@ createFunctionHelper(LLVMContext &VMContext, DIDescriptor Context, StringRef Nam StringRef LinkageName, DIFile File, unsigned LineNo, DICompositeType Ty, bool isLocalToUnit, bool isDefinition, unsigned ScopeLine, unsigned Flags, bool isOptimized, - Function *Fn, MDNode *TParams, MDNode *Decl, + Function *Fn, MDNode *TParams, MDNode *Decl, MDNode *Vars, std::function)> CreateFunc) { assert(Ty.getTag() == dwarf::DW_TAG_subroutine_type && "function types should be subroutines"); - Value *TElts[] = {HeaderBuilder::get(DW_TAG_base_type).get(VMContext)}; Value *Elts[] = { HeaderBuilder::get(dwarf::DW_TAG_subprogram) .concat(Name) @@ -957,7 +956,7 @@ createFunctionHelper(LLVMContext &VMContext, DIDescriptor Context, StringRef Nam .concat(ScopeLine) .get(VMContext), File.getFileNode(), DIScope(getNonCompileUnitScope(Context)).getRef(), Ty, - nullptr, Fn, TParams, Decl, MDNode::getTemporary(VMContext, TElts)}; + nullptr, Fn, TParams, Decl, Vars}; DISubprogram S(CreateFunc(Elts)); assert(S.isSubprogram() && @@ -976,6 +975,7 @@ DISubprogram DIBuilder::createFunction(DIDescriptor Context, StringRef Name, return createFunctionHelper(VMContext, Context, Name, LinkageName, File, LineNo, Ty, isLocalToUnit, isDefinition, ScopeLine, Flags, isOptimized, Fn, TParams, Decl, + MDNode::getTemporary(VMContext, None), [&] (ArrayRef Elts) -> MDNode *{ MDNode *Node = MDNode::get(VMContext, Elts); // Create a named metadata so that we @@ -996,7 +996,7 @@ DIBuilder::createTempFunctionFwdDecl(DIDescriptor Context, StringRef Name, MDNode *TParams, MDNode *Decl) { return createFunctionHelper(VMContext, Context, Name, LinkageName, File, LineNo, Ty, isLocalToUnit, isDefinition, ScopeLine, - Flags, isOptimized, Fn, TParams, Decl, + Flags, isOptimized, Fn, TParams, Decl, nullptr, [&] (ArrayRef Elts) { return MDNode::getTemporary(VMContext, Elts); });