From d9f66ead76cfd0d59edf5b4354e204a7bff2e9a5 Mon Sep 17 00:00:00 2001 From: yhirose Date: Fri, 24 Jan 2020 23:06:30 -0500 Subject: [PATCH] Fixed build problem with LLVM 8.0 or lower --- pl0/pl0.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pl0/pl0.cc b/pl0/pl0.cc index 4dd2160..6598c36 100644 --- a/pl0/pl0.cc +++ b/pl0/pl0.cc @@ -604,8 +604,12 @@ struct LLVM { FunctionType::get(builder_.getInt32Ty(), PointerType::get(builder_.getInt8Ty(), 0), true)); +#if LLVM_VERSION_MAJOR >= 9 auto funccallee = module_->getOrInsertFunction("out", builder_.getVoidTy(), builder_.getInt32Ty()); auto outC = funccallee.getCallee(); +#else + auto outC = module_->getOrInsertFunction("out", builder_.getVoidTy(), builder_.getInt32Ty()); +#endif auto outF = cast(outC); { @@ -623,8 +627,12 @@ struct LLVM { } void compile_program(const shared_ptr ast) { +#if LLVM_VERSION_MAJOR >= 9 auto funccallee = module_->getOrInsertFunction("main", builder_.getVoidTy()); auto c = funccallee.getCallee(); +#else + auto c = module_->getOrInsertFunction("main", builder_.getVoidTy()); +#endif auto fn = cast(c); { @@ -669,8 +677,12 @@ struct LLVM { std::vector pt(block->scope->free_variables.size(), Type::getInt32PtrTy(context_)); auto ft = FunctionType::get(builder_.getVoidTy(), pt, false); +#if LLVM_VERSION_MAJOR >= 9 auto funccallee = module_->getOrInsertFunction(ident, ft); auto c = funccallee.getCallee(); +#else + auto c = module_->getOrInsertFunction(ident, ft); +#endif auto fn = cast(c); {