[llvm] Module::getOrInsertFunction: set debug info format (PR #82505)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 21 08:29:41 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Harald van Dijk (hvdijk)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/82505.diff
1 Files Affected:
- (modified) llvm/lib/IR/Module.cpp (+1-2)
``````````diff
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.
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/82505
More information about the llvm-commits
mailing list