[llvm-commits] CVS: llvm/include/llvm/Module.h
Chris Lattner
sabre at nondot.org
Sun Jan 7 00:09:43 PST 2007
Changes in directory llvm/include/llvm:
Module.h updated: 1.78 -> 1.79
---
Log message:
Change the interface to Module::getOrInsertFunction to be easier to use,
to resolve PR1088: http://llvm.org/PR1088 , and to help PR411: http://llvm.org/PR411 .
---
Diffs of the changes: (+10 -4)
Module.h | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
Index: llvm/include/llvm/Module.h
diff -u llvm/include/llvm/Module.h:1.78 llvm/include/llvm/Module.h:1.79
--- llvm/include/llvm/Module.h:1.78 Sat Jan 6 01:24:43 2007
+++ llvm/include/llvm/Module.h Sun Jan 7 02:09:25 2007
@@ -166,15 +166,21 @@
/// @{
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.
More information about the llvm-commits
mailing list