aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Module.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-01-07 08:09:25 +0000
committerChris Lattner <sabre@nondot.org>2007-01-07 08:09:25 +0000
commit70d130516a38013ef6262dd2da5accbea7932e30 (patch)
treebe16c5211368485df5228a27210f087ed3448fa1 /include/llvm/Module.h
parent12969887a333317cf5beafaf613865787913609d (diff)
Change the interface to Module::getOrInsertFunction to be easier to use,
to resolve PR1088, and to help PR411. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32988 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Module.h')
-rw-r--r--include/llvm/Module.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/llvm/Module.h b/include/llvm/Module.h
index e5c157be95..85fdb868ed 100644
--- a/include/llvm/Module.h
+++ b/include/llvm/Module.h
@@ -166,15 +166,21 @@ public:
/// @{
public:
/// getOrInsertFunction - Look up the specified function in the module symbol
- /// table. If it does not exist, add a prototype for the function and return
- /// it.
- Function *getOrInsertFunction(const std::string &Name, const FunctionType *T);
+ /// table. Four possibilities:
+ /// 1. If it does not exist, add a prototype for the function and return it.
+ /// 2. If it exists, and has internal linkage, the existing function is
+ /// renamed and a new one is inserted.
+ /// 3. Otherwise, if the existing function has the correct prototype, return
+ /// the existing function.
+ /// 4. Finally, the function exists but has the wrong prototype: return the
+ /// function with a constantexpr cast to the right prototype.
+ Constant *getOrInsertFunction(const std::string &Name, const FunctionType *T);
/// getOrInsertFunction - Look up the specified function in the module symbol
/// table. If it does not exist, add a prototype for the function and return
/// it. This version of the method takes a null terminated list of function
/// arguments, which makes it easier for clients to use.
- Function *getOrInsertFunction(const std::string &Name, const Type *RetTy,...)
+ Constant *getOrInsertFunction(const std::string &Name, const Type *RetTy,...)
END_WITH_NULL;
/// getFunction - Look up the specified function in the module symbol table.