|
7 | 7 | #include "llvm/Support/Alignment.h" |
8 | 8 | #include <lld/Common/Driver.h> |
9 | 9 | #include <llvm/IR/ConstantFolder.h> |
| 10 | +#include <llvm/IR/DerivedTypes.h> |
10 | 11 | #include <llvm/IR/DiagnosticInfo.h> |
11 | 12 | #include <llvm/IR/IRBuilder.h> |
12 | 13 | #include <llvm/Support/ToolOutputFile.h> |
@@ -131,7 +132,13 @@ class BackendConsumer : public ASTConsumer { |
131 | 132 | llvm::BasicBlock *Entry = |
132 | 133 | llvm::BasicBlock::Create(VMContext, "entry", Func); |
133 | 134 | Builder.SetInsertPoint(Entry); |
134 | | - llvm::Value *Result = llvm::UndefValue::get(Module.getTypeByName("bytes")); |
| 135 | + llvm::Value *Result = |
| 136 | +#if LLVM_VERSION_MAJOR >= 12 |
| 137 | + llvm::UndefValue::get( |
| 138 | + llvm::StructType::getTypeByName(VMContext, "bytes")); |
| 139 | +#else |
| 140 | + llvm::UndefValue::get(Module.getTypeByName("bytes")); |
| 141 | +#endif |
135 | 142 | Result = Builder.CreateInsertValue(Result, Builder.getIntN(256, Length), 0); |
136 | 143 | Result = Builder.CreateInsertValue( |
137 | 144 | Result, Builder.CreateBitCast(GV, Builder.getInt8PtrTy()), 1); |
@@ -181,7 +188,7 @@ class BackendConsumer : public ASTConsumer { |
181 | 188 | if (auto Error = removeExports(Wasm->TmpName)) { |
182 | 189 | llvm::consumeError(Wasm->discard()); |
183 | 190 | llvm::consumeError(Object->discard()); |
184 | | - return Error; |
| 191 | + return std::move(Error); |
185 | 192 | } |
186 | 193 |
|
187 | 194 | auto Binary = llvm::MemoryBuffer::getFile(Wasm->TmpName); |
@@ -289,7 +296,7 @@ std::unique_ptr<ASTConsumer> |
289 | 296 | CodeGenAction::CreateASTConsumer(CompilerInstance &CI, llvm::StringRef InFile) { |
290 | 297 | return std::make_unique<BackendConsumer>( |
291 | 298 | Action, CI.getDiagnostics(), CI.getCodeGenOpts(), CI.getTargetOpts(), |
292 | | - InFile, *VMContext, CI.GetOutputStreamFunc()); |
| 299 | + InFile.str(), *VMContext, CI.GetOutputStreamFunc()); |
293 | 300 | } |
294 | 301 |
|
295 | 302 | EmitAssemblyAction::EmitAssemblyAction(llvm::LLVMContext *VMContext) |
|
0 commit comments