[llvm] [LLVM-C] Upstream `LLVMGetOrInsertFunction` from rustc (PR #162235)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 7 06:13:56 PDT 2025
================
@@ -2988,6 +2988,22 @@ LLVM_C_ABI char *LLVMIntrinsicCopyOverloadedName2(LLVMModuleRef Mod,
*/
LLVM_C_ABI LLVMBool LLVMIntrinsicIsOverloaded(unsigned ID);
+/**
+ * Obtain or insert a function into a module.
+ *
+ * If a function with the specified name already exists in the module, it
+ * is returned. Otherwise, a new function is created in the module with the
+ * specified name and type and is returned.
+ *
+ * The returned value corresponds to a llvm::Function instance.
+ *
+ * @see llvm::Module::getOrInsertFunction()
+ */
+LLVM_C_ABI LLVMValueRef LLVMGetOrInsertFunction(LLVMModuleRef M,
+ const char *Name,
+ size_t NameLen,
+ LLVMTypeRef FunctionTy);
----------------
nikic wrote:
Move this next to LLVMAddFunction.
https://github.com/llvm/llvm-project/pull/162235
More information about the llvm-commits
mailing list