diff options
Diffstat (limited to 'llvm/examples/BrainF/BrainF.cpp')
-rw-r--r-- | llvm/examples/BrainF/BrainF.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/llvm/examples/BrainF/BrainF.cpp b/llvm/examples/BrainF/BrainF.cpp index bcd75325e80..b4cbc780a04 100644 --- a/llvm/examples/BrainF/BrainF.cpp +++ b/llvm/examples/BrainF/BrainF.cpp @@ -72,19 +72,17 @@ void BrainF::header(LLVMContext& C) { Tys); //declare i32 @getchar() - getchar_func = cast<Function>(module-> - getOrInsertFunction("getchar", IntegerType::getInt32Ty(C))); + getchar_func = + module->getOrInsertFunction("getchar", IntegerType::getInt32Ty(C)); //declare i32 @putchar(i32) - putchar_func = cast<Function>(module-> - getOrInsertFunction("putchar", IntegerType::getInt32Ty(C), - IntegerType::getInt32Ty(C))); + putchar_func = module->getOrInsertFunction( + "putchar", IntegerType::getInt32Ty(C), IntegerType::getInt32Ty(C)); //Function header //define void @brainf() - brainf_func = cast<Function>(module-> - getOrInsertFunction("brainf", Type::getVoidTy(C))); + brainf_func = module->getOrInsertFunction("brainf", Type::getVoidTy(C)); builder = new IRBuilder<>(BasicBlock::Create(C, label, brainf_func)); @@ -153,9 +151,9 @@ void BrainF::header(LLVMContext& C) { "aberrormsg"); //declare i32 @puts(i8 *) - Function *puts_func = cast<Function>(module-> - getOrInsertFunction("puts", IntegerType::getInt32Ty(C), - PointerType::getUnqual(IntegerType::getInt8Ty(C)))); + FunctionCallee puts_func = module->getOrInsertFunction( + "puts", IntegerType::getInt32Ty(C), + PointerType::getUnqual(IntegerType::getInt8Ty(C))); //brainf.aberror: aberrorbb = BasicBlock::Create(C, label, brainf_func); |