Mercurial > projects > ldc
comparison gen/toobj.cpp @ 1521:982eb70e83b2
Fix build for LLVM >= r74640
Some LLVM objects now take a 'Context' to make multi-threaded apps easier.
Since we're not multi-threaded it's safe to use llvm::getGlobalContext()
which gives us the same behavior as we had before.
author | Benjamin Kramer <benny.kra@gmail.com> |
---|---|
date | Fri, 03 Jul 2009 17:24:35 +0200 |
parents | 2292878925f4 |
children | ad7f2f1862d6 |
comparison
equal
deleted
inserted
replaced
1520:1a93c3da09ef | 1521:982eb70e83b2 |
---|---|
9 | 9 |
10 #include <cstddef> | 10 #include <cstddef> |
11 #include <fstream> | 11 #include <fstream> |
12 | 12 |
13 #include "gen/llvm.h" | 13 #include "gen/llvm.h" |
14 #include "gen/llvm-version.h" | |
14 #include "llvm/Analysis/Verifier.h" | 15 #include "llvm/Analysis/Verifier.h" |
15 #include "llvm/Bitcode/ReaderWriter.h" | 16 #include "llvm/Bitcode/ReaderWriter.h" |
17 #if LLVM_REV >= 74640 | |
18 #include "llvm/LLVMContext.h" | |
19 #endif | |
16 #include "llvm/Module.h" | 20 #include "llvm/Module.h" |
17 #include "llvm/ModuleProvider.h" | 21 #include "llvm/ModuleProvider.h" |
18 #include "llvm/PassManager.h" | 22 #include "llvm/PassManager.h" |
19 #include "llvm/LinkAllPasses.h" | 23 #include "llvm/LinkAllPasses.h" |
20 #include "llvm/System/Program.h" | 24 #include "llvm/System/Program.h" |
41 #include "gen/classes.h" | 45 #include "gen/classes.h" |
42 #include "gen/cl_options.h" | 46 #include "gen/cl_options.h" |
43 #include "gen/functions.h" | 47 #include "gen/functions.h" |
44 #include "gen/irstate.h" | 48 #include "gen/irstate.h" |
45 #include "gen/llvmhelpers.h" | 49 #include "gen/llvmhelpers.h" |
46 #include "gen/llvm-version.h" | |
47 #include "gen/logger.h" | 50 #include "gen/logger.h" |
48 #include "gen/optimizer.h" | 51 #include "gen/optimizer.h" |
49 #include "gen/programs.h" | 52 #include "gen/programs.h" |
50 #include "gen/rttibuilder.h" | 53 #include "gen/rttibuilder.h" |
51 #include "gen/runtime.h" | 54 #include "gen/runtime.h" |
92 if (md != 0) | 95 if (md != 0) |
93 mname = md->toChars(); | 96 mname = md->toChars(); |
94 | 97 |
95 // create a new ir state | 98 // create a new ir state |
96 // TODO look at making the instance static and moving most functionality into IrModule where it belongs | 99 // TODO look at making the instance static and moving most functionality into IrModule where it belongs |
100 #if LLVM_REV >= 74640 | |
101 IRState ir(new llvm::Module(mname, llvm::getGlobalContext())); | |
102 #else | |
97 IRState ir(new llvm::Module(mname)); | 103 IRState ir(new llvm::Module(mname)); |
104 #endif | |
98 gIR = &ir; | 105 gIR = &ir; |
99 ir.dmodule = this; | 106 ir.dmodule = this; |
100 | 107 |
101 // reset all IR data stored in Dsymbols | 108 // reset all IR data stored in Dsymbols |
102 IrDsymbol::resetAll(); | 109 IrDsymbol::resetAll(); |