Revert "Turn some C-style vararg into variadic templates"
This reverts commit r299699, the examples needs to be updated. llvm-svn: 299702
This commit is contained in:
@@ -147,6 +147,47 @@ Constant *Module::getOrInsertFunction(StringRef Name,
|
||||
return getOrInsertFunction(Name, Ty, AttributeList());
|
||||
}
|
||||
|
||||
// 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.
|
||||
//
|
||||
Constant *Module::getOrInsertFunction(StringRef Name,
|
||||
AttributeList AttributeList, Type *RetTy,
|
||||
...) {
|
||||
va_list Args;
|
||||
va_start(Args, RetTy);
|
||||
|
||||
// Build the list of argument types...
|
||||
std::vector<Type*> ArgTys;
|
||||
while (Type *ArgTy = va_arg(Args, Type*))
|
||||
ArgTys.push_back(ArgTy);
|
||||
|
||||
va_end(Args);
|
||||
|
||||
// Build the function type and chain to the other getOrInsertFunction...
|
||||
return getOrInsertFunction(Name,
|
||||
FunctionType::get(RetTy, ArgTys, false),
|
||||
AttributeList);
|
||||
}
|
||||
|
||||
Constant *Module::getOrInsertFunction(StringRef Name,
|
||||
Type *RetTy, ...) {
|
||||
va_list Args;
|
||||
va_start(Args, RetTy);
|
||||
|
||||
// Build the list of argument types...
|
||||
std::vector<Type*> ArgTys;
|
||||
while (Type *ArgTy = va_arg(Args, Type*))
|
||||
ArgTys.push_back(ArgTy);
|
||||
|
||||
va_end(Args);
|
||||
|
||||
// Build the function type and chain to the other getOrInsertFunction...
|
||||
return getOrInsertFunction(Name, FunctionType::get(RetTy, ArgTys, false),
|
||||
AttributeList());
|
||||
}
|
||||
|
||||
// getFunction - Look up the specified function in the module symbol table.
|
||||
// If it does not exist, return null.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user