[llvm] r222434 - Do not create a replaceable Variables MDNode for function forward decls.

Frederic Riss friss at apple.com
Thu Nov 20 07:52:34 PST 2014


Author: friss
Date: Thu Nov 20 09:52:34 2014
New Revision: 222434

URL: http://llvm.org/viewvc/llvm-project?rev=222434&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/IR/DIBuilder.cpp

Modified: llvm/trunk/lib/IR/DIBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=222434&r1=222433&r2=222434&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DIBuilder.cpp (original)
+++ llvm/trunk/lib/IR/DIBuilder.cpp Thu Nov 20 09:52:34 2014
@@ -937,11 +937,10 @@ createFunctionHelper(LLVMContext &VMCont
                      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<MDNode *(ArrayRef<Value *>)> 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 &VMCont
           .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(D
   return createFunctionHelper(VMContext, Context, Name, LinkageName, File,
                               LineNo, Ty, isLocalToUnit, isDefinition, ScopeLine,
                               Flags, isOptimized, Fn, TParams, Decl,
+                              MDNode::getTemporary(VMContext, None),
                               [&] (ArrayRef<Value *> Elts) -> MDNode *{
                                 MDNode *Node = MDNode::get(VMContext, Elts);
                                 // Create a named metadata so that we
@@ -996,7 +996,7 @@ DIBuilder::createTempFunctionFwdDecl(DID
                                      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<Value *> Elts) {
                                 return MDNode::getTemporary(VMContext, Elts);
                               });





More information about the llvm-commits mailing list