llvm.org GIT mirror llvm / 0ae8e87
Implement new method git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8238 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 16 years ago
1 changed file(s) with 24 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1111 #include "Support/LeakDetector.h"
1212 #include "SymbolTableListTraitsImpl.h"
1313 #include
14 #include
1415 #include
1516
1617 Function *ilist_traits::createNode() {
9394 return New; // Return the new prototype...
9495 }
9596 }
97
98 // getOrInsertFunction - Look up the specified function in the module symbol
99 // table. If it does not exist, add a prototype for the function and return it.
100 // This version of the method takes a null terminated list of function
101 // arguments, which makes it easier for clients to use.
102 //
103 Function *Module::getOrInsertFunction(const std::string &Name,
104 const Type *RetTy, ...) {
105 va_list Args;
106 va_start(Args, RetTy);
107
108 // Build the list of argument types...
109 std::vector ArgTys;
110 while (const Type *ArgTy = va_arg(Args, const Type*))
111 ArgTys.push_back(ArgTy);
112
113 va_end(Args);
114
115 // Build the function type and chain to the other getOrInsertFunction...
116 return getOrInsertFunction(Name, FunctionType::get(RetTy, ArgTys, false));
117 }
118
119
96120
97121 // getFunction - Look up the specified function in the module symbol table.
98122 // If it does not exist, return null.