aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Module.cpp
diff options
context:
space:
mode:
authorHarald van Dijk <harald@gigawatt.nl>2024-02-21 16:40:22 +0000
committerGitHub <noreply@github.com>2024-02-21 16:40:22 +0000
commit162fa4dd25d631d0ab7816ec6081bcaff951a23c (patch)
treed3f4ece07a3222970c39be16a3fd899a61e7fab1 /llvm/lib/IR/Module.cpp
parent2e29c91b96832504b9008be5e095f7dd640cdea0 (diff)
downloadllvm-162fa4dd25d631d0ab7816ec6081bcaff951a23c.zip
llvm-162fa4dd25d631d0ab7816ec6081bcaff951a23c.tar.gz
llvm-162fa4dd25d631d0ab7816ec6081bcaff951a23c.tar.bz2
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.
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
-rw-r--r--llvm/lib/IR/Module.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index eeb90a6..1946db2 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.
}