fix LLVM7.0 build (#2578)

This commit is contained in:
Johan Engelen 2018-02-18 22:07:01 +01:00 committed by Ivan Butygin
parent effce1723d
commit aa979e6e90
4 changed files with 28 additions and 7 deletions

View file

@ -657,7 +657,11 @@ void setupModuleBitcodeData(const llvm::Module &srcModule, IRState *irs,
llvm::SmallString<1024> str;
llvm::raw_svector_ostream os(str);
#if LDC_LLVM_VER >= 700
llvm::WriteBitcodeToFile(srcModule, os);
#else
llvm::WriteBitcodeToFile(&srcModule, os);
#endif
auto runtimeCompiledIr = new llvm::GlobalVariable(
irs->module, llvm::Type::getInt8PtrTy(irs->context()), true,
@ -724,7 +728,12 @@ void generateBitcodeForDynamicCompile(IRState *irs) {
llvm::ValueToValueMapTy unused;
auto newModule = llvm::CloneModule(
&irs->module, unused, [&](const llvm::GlobalValue *val) -> bool {
#if LDC_LLVM_VER >= 700
irs->module,
#else
&irs->module,
#endif
unused, [&](const llvm::GlobalValue *val) -> bool {
// We don't dereference here, so const_cast should be safe
auto it = filter.find(const_cast<llvm::GlobalValue *>(val));
return filter.end() != it &&