summaryrefslogtreecommitdiffstats
path: root/llvm/examples/BrainF
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
commit59a2d7b9093617aff6b6f147ba267bc788aa08b7 (patch)
tree2ffc9141cd19edf0d123828627a9f1e8c4c19907 /llvm/examples/BrainF
parentde3b9a2ecc7e9ebe3fc1780aede0223821c52d2a (diff)
downloadbcm5719-llvm-59a2d7b9093617aff6b6f147ba267bc788aa08b7.tar.gz
bcm5719-llvm-59a2d7b9093617aff6b6f147ba267bc788aa08b7.zip
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 llvm-svn: 299949
Diffstat (limited to 'llvm/examples/BrainF')
-rw-r--r--llvm/examples/BrainF/BrainF.cpp8
-rw-r--r--llvm/examples/BrainF/BrainFDriver.cpp2
2 files changed, 5 insertions, 5 deletions
diff --git a/llvm/examples/BrainF/BrainF.cpp b/llvm/examples/BrainF/BrainF.cpp
index 91d813a6c3b..8af34d04701 100644
--- a/llvm/examples/BrainF/BrainF.cpp
+++ b/llvm/examples/BrainF/BrainF.cpp
@@ -74,18 +74,18 @@ void BrainF::header(LLVMContext& C) {
//declare i32 @getchar()
getchar_func = cast<Function>(module->
- getOrInsertFunction("getchar", IntegerType::getInt32Ty(C), NULL));
+ getOrInsertFunction("getchar", IntegerType::getInt32Ty(C)));
//declare i32 @putchar(i32)
putchar_func = cast<Function>(module->
getOrInsertFunction("putchar", IntegerType::getInt32Ty(C),
- IntegerType::getInt32Ty(C), NULL));
+ IntegerType::getInt32Ty(C)));
//Function header
//define void @brainf()
brainf_func = cast<Function>(module->
- getOrInsertFunction("brainf", Type::getVoidTy(C), NULL));
+ getOrInsertFunction("brainf", Type::getVoidTy(C)));
builder = new IRBuilder<>(BasicBlock::Create(C, label, brainf_func));
@@ -156,7 +156,7 @@ void BrainF::header(LLVMContext& C) {
//declare i32 @puts(i8 *)
Function *puts_func = cast<Function>(module->
getOrInsertFunction("puts", IntegerType::getInt32Ty(C),
- PointerType::getUnqual(IntegerType::getInt8Ty(C)), NULL));
+ PointerType::getUnqual(IntegerType::getInt8Ty(C))));
//brainf.aberror:
aberrorbb = BasicBlock::Create(C, label, brainf_func);
diff --git a/llvm/examples/BrainF/BrainFDriver.cpp b/llvm/examples/BrainF/BrainFDriver.cpp
index d704506d244..65f8033a7e2 100644
--- a/llvm/examples/BrainF/BrainFDriver.cpp
+++ b/llvm/examples/BrainF/BrainFDriver.cpp
@@ -77,7 +77,7 @@ void addMainFunction(Module *mod) {
getOrInsertFunction("main", IntegerType::getInt32Ty(mod->getContext()),
IntegerType::getInt32Ty(mod->getContext()),
PointerType::getUnqual(PointerType::getUnqual(
- IntegerType::getInt8Ty(mod->getContext()))), NULL));
+ IntegerType::getInt8Ty(mod->getContext())))));
{
Function::arg_iterator args = main_func->arg_begin();
Value *arg_0 = &*args++;
OpenPOWER on IntegriCloud