From 162fa4dd25d631d0ab7816ec6081bcaff951a23c Mon Sep 17 00:00:00 2001 From: Harald van Dijk Date: Wed, 21 Feb 2024 16:40:22 +0000 Subject: 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. --- llvm/lib/IR/Module.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'llvm/lib/IR/Module.cpp') 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. } -- cgit v1.1