[llvm] 162fa4d - Module::getOrInsertFunction: set debug info format (#82505)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 08:40:25 PST 2024


Author: Harald van Dijk
Date: 2024-02-21T16:40:22Z
New Revision: 162fa4dd25d631d0ab7816ec6081bcaff951a23c

URL: https://github.com/llvm/llvm-project/commit/162fa4dd25d631d0ab7816ec6081bcaff951a23c
DIFF: https://github.com/llvm/llvm-project/commit/162fa4dd25d631d0ab7816ec6081bcaff951a23c.diff

LOG: Module::getOrInsertFunction: set debug info format (#82505)

Function::Function's constructor sets the debug info format based on the
passed in parent Module, so by using this rather than modifying the
function list directly, we pick up the debug info format automatically.

Added: 
    

Modified: 
    llvm/lib/IR/Module.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index eeb90a6cb3c465..1946db2ee0be7e 100644
--- a/llvm/lib/IR/Module.cpp
+++ b/llvm/lib/IR/Module.cpp
@@ -149,10 +149,9 @@ FunctionCallee Module::getOrInsertFunction(StringRef Name, FunctionType *Ty,
   if (!F) {
     // Nope, add it
     Function *New = Function::Create(Ty, GlobalVariable::ExternalLinkage,
-                                     DL.getProgramAddressSpace(), Name);
+                                     DL.getProgramAddressSpace(), Name, this);
     if (!New->isIntrinsic())       // Intrinsics get attrs set on construction
       New->setAttributes(AttributeList);
-    FunctionList.push_back(New);
     return {Ty, New}; // Return the new prototype.
   }
 


        


More information about the llvm-commits mailing list