Mercurial > projects > ldc
comparison gen/logger.cpp @ 1650:40bd4a0d4870
Update to work with LLVM 2.7.
Removed use of dyn_cast, llvm no compiles
without exceptions and rtti by
default. We do need exceptions for the libconfig stuff, but rtti isn't
necessary (anymore).
Debug info needs to be rewritten, as in LLVM 2.7 the format has
completely changed. To have something to look at while rewriting, the
old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means
that you have to define this to compile at the moment.
Updated tango 0.99.9 patch to include updated EH runtime code, which is
needed for LLVM 2.7 as well.
author | Tomas Lindquist Olsen |
---|---|
date | Wed, 19 May 2010 12:42:32 +0200 |
parents | 2292878925f4 |
children |
comparison
equal
deleted
inserted
replaced
1649:36da40ecbbe0 | 1650:40bd4a0d4870 |
---|---|
10 | 10 |
11 #include "llvm/Support/CommandLine.h" | 11 #include "llvm/Support/CommandLine.h" |
12 | 12 |
13 #include "llvm/GlobalValue.h" | 13 #include "llvm/GlobalValue.h" |
14 #include "llvm/Support/Casting.h" | 14 #include "llvm/Support/Casting.h" |
15 #include "llvm/Support/raw_ostream.h" | 15 #include "llvm/Support/raw_os_ostream.h" |
16 #include "llvm/Assembly/Writer.h" | 16 #include "llvm/Assembly/Writer.h" |
17 | 17 |
18 #include "gen/logger.h" | 18 #include "gen/logger.h" |
19 #include "gen/irstate.h" | 19 #include "gen/irstate.h" |
20 | 20 |
25 | 25 |
26 void Stream::writeValue(std::ostream& OS, const llvm::Value& V) { | 26 void Stream::writeValue(std::ostream& OS, const llvm::Value& V) { |
27 // Constants don't always get their types pretty-printed. | 27 // Constants don't always get their types pretty-printed. |
28 // (Only treat non-global constants like this, so that e.g. global variables | 28 // (Only treat non-global constants like this, so that e.g. global variables |
29 // still get their initializers printed) | 29 // still get their initializers printed) |
30 llvm::raw_os_ostream raw(OS); | |
30 if (llvm::isa<llvm::Constant>(V) && !llvm::isa<llvm::GlobalValue>(V)) | 31 if (llvm::isa<llvm::Constant>(V) && !llvm::isa<llvm::GlobalValue>(V)) |
31 llvm::WriteAsOperand(OS, &V, true, gIR->module); | 32 llvm::WriteAsOperand(raw, &V, true, gIR->module); |
32 else | 33 else |
33 OS << V; | 34 V.print(raw); |
34 } | 35 } |
35 | 36 |
36 namespace Logger | 37 namespace Logger |
37 { | 38 { |
38 static std::string indent_str; | 39 static std::string indent_str; |