summaryrefslogtreecommitdiff
path: root/examples/HowToUseJIT/HowToUseJIT.cpp
diff options
context:
space:
mode:
authorSerge Guelton <sguelton@quarkslab.com>2017-04-11 15:01:18 +0000
committerSerge Guelton <sguelton@quarkslab.com>2017-04-11 15:01:18 +0000
commit9d54400bba7eb04bca80fce97fa170452d19eaf1 (patch)
tree64e13b01cf723975134a80e3940dc21c3f537be7 /examples/HowToUseJIT/HowToUseJIT.cpp
parentafa9824a92d8968c3f85bed2740c35fa79a4d4c1 (diff)
Module::getOrInsertFunction is using C-style vararg instead of variadic templates.
From a user prospective, it forces the use of an annoying nullptr to mark the end of the vararg, and there's not type checking on the arguments. The variadic template is an obvious solution to both issues. Differential Revision: https://reviews.llvm.org/D31070 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299949 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples/HowToUseJIT/HowToUseJIT.cpp')
-rw-r--r--examples/HowToUseJIT/HowToUseJIT.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/examples/HowToUseJIT/HowToUseJIT.cpp b/examples/HowToUseJIT/HowToUseJIT.cpp
index 0050d27b45d..f141fa5a7f5 100644
--- a/examples/HowToUseJIT/HowToUseJIT.cpp
+++ b/examples/HowToUseJIT/HowToUseJIT.cpp
@@ -69,11 +69,9 @@ int main() {
// Create the add1 function entry and insert this entry into module M. The
// function will have a return type of "int" and take an argument of "int".
- // The '0' terminates the list of argument types.
Function *Add1F =
cast<Function>(M->getOrInsertFunction("add1", Type::getInt32Ty(Context),
- Type::getInt32Ty(Context),
- nullptr));
+ Type::getInt32Ty(Context)));
// Add a basic block to the function. As before, it automatically inserts
// because of the last argument.
@@ -102,8 +100,7 @@ int main() {
// Now we're going to create function `foo', which returns an int and takes no
// arguments.
Function *FooF =
- cast<Function>(M->getOrInsertFunction("foo", Type::getInt32Ty(Context),
- nullptr));
+ cast<Function>(M->getOrInsertFunction("foo", Type::getInt32Ty(Context)));
// Add a basic block to the FooF function.
BB = BasicBlock::Create(Context, "EntryBlock", FooF);