--- a/src/libasr/codegen/KaleidoscopeJIT.h +++ b/src/libasr/codegen/KaleidoscopeJIT.h @@ -25,6 +25,7 @@ #include "llvm/IR/DataLayout.h" #include "llvm/IR/LLVMContext.h" #include +#include namespace llvm { namespace orc { @@ -71,7 +72,7 @@ auto CPU = "generic"; auto Features = ""; TargetOptions opt; - auto RM = Optional(); + auto RM = std::optional(); TM = Target->createTargetMachine(TargetTriple, CPU, Features, opt, RM); } --- a/src/libasr/codegen/asr_to_llvm.cpp +++ b/src/libasr/codegen/asr_to_llvm.cpp @@ -276,7 +276,7 @@ // to our new block builder->CreateBr(bb); } - fn->getBasicBlockList().push_back(bb); + fn->insert(fn->end(), bb); builder->SetInsertPoint(bb); } @@ -4718,7 +4718,7 @@ start_new_block(blockstart); llvm::BasicBlock *blockend = llvm::BasicBlock::Create(context, blockend_name); llvm::Function *fn = blockstart->getParent(); - fn->getBasicBlockList().push_back(blockend); + fn->insert(fn->end(), blockend); builder->SetInsertPoint(blockstart); loop_or_block_end.push_back(blockend); loop_or_block_end_names.push_back(blockend_name); --- a/src/libasr/codegen/evaluator.cpp +++ b/src/libasr/codegen/evaluator.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -178,7 +179,7 @@ std::string CPU = "generic"; std::string features = ""; llvm::TargetOptions opt; - llvm::Optional RM = llvm::Reloc::Model::PIC_; + std::optional RM = llvm::Reloc::Model::PIC_; TM = target->createTargetMachine(target_triple, CPU, features, opt, RM); // For some reason the JIT requires a different TargetMachine --- a/src/libasr/codegen/llvm_utils.cpp +++ b/src/libasr/codegen/llvm_utils.cpp @@ -189,7 +189,7 @@ // to our new block builder->CreateBr(bb); } - fn->getBasicBlockList().push_back(bb); + fn->insert(fn->end(), bb); builder->SetInsertPoint(bb); }