lfortran: Fix build against LLVM 16

This commit is contained in:
Tee KOBAYASHI 2023-04-19 21:55:59 +09:00 committed by xtkoba
parent 3bc2aafa76
commit 97bd023b1a
2 changed files with 60 additions and 1 deletions

View File

@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="A modern open-source interactive Fortran compiler"
TERMUX_PKG_LICENSE="BSD 3-Clause"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.18.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=git+https://github.com/lfortran/lfortran
TERMUX_PKG_DEPENDS="clang, libandroid-complex-math, libc++, ncurses, zlib, zstd"
TERMUX_PKG_BUILD_DEPENDS="libllvm-static"

View File

@ -0,0 +1,59 @@
--- 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 <memory>
+#include <optional>
namespace llvm {
namespace orc {
@@ -71,7 +72,7 @@
auto CPU = "generic";
auto Features = "";
TargetOptions opt;
- auto RM = Optional<Reloc::Model>();
+ auto RM = std::optional<Reloc::Model>();
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);
}
--- a/src/libasr/codegen/evaluator.cpp
+++ b/src/libasr/codegen/evaluator.cpp
@@ -1,5 +1,6 @@
#include <iostream>
#include <fstream>
+#include <optional>
#include <llvm/IR/LLVMContext.h>
#include <llvm/ADT/STLExtras.h>
@@ -178,7 +179,7 @@
std::string CPU = "generic";
std::string features = "";
llvm::TargetOptions opt;
- llvm::Optional<llvm::Reloc::Model> RM = llvm::Reloc::Model::PIC_;
+ std::optional<llvm::Reloc::Model> 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);
}