diff options
author | Diana Picus <diana.picus@linaro.org> | 2017-04-11 10:07:12 +0000 |
---|---|---|
committer | Diana Picus <diana.picus@linaro.org> | 2017-04-11 10:07:12 +0000 |
commit | b050c7fbe0b2a40fa51c8235083d9a4bd4c38dac (patch) | |
tree | 0d0c8e860c034407198d77f05d83ee9b091afc81 /llvm/lib/IR/Module.cpp | |
parent | d4fa2e634876672a680a300442ed917761a8c3ff (diff) | |
download | bcm5719-llvm-b050c7fbe0b2a40fa51c8235083d9a4bd4c38dac.tar.gz bcm5719-llvm-b050c7fbe0b2a40fa51c8235083d9a4bd4c38dac.zip |
Revert "Turn some C-style vararg into variadic templates"
This reverts commit r299925 because it broke the buildbots. See e.g.
http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/6008
llvm-svn: 299928
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
-rw-r--r-- | llvm/lib/IR/Module.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp index fec9df19368..c3bfee5cb68 100644 --- a/llvm/lib/IR/Module.cpp +++ b/llvm/lib/IR/Module.cpp @@ -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. // |