Created
August 28, 2009 16:25
-
-
Save dnadlinger/177081 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gen/asmstmt.cpp b/gen/asmstmt.cpp | |
--- a/gen/asmstmt.cpp | |
+++ b/gen/asmstmt.cpp | |
@@ -3,6 +3,7 @@ | |
#include "gen/llvm.h" | |
#include "llvm/InlineAsm.h" | |
+#include "llvm/Support/raw_ostream.h" | |
//#include "d-gcc-includes.h" | |
//#include "total.h" | |
@@ -257,7 +258,7 @@ | |
break; | |
case Arg_FrameRelative: | |
// FIXME | |
-llvm::cout << "asm fixme Arg_FrameRelative" << std::endl; | |
+llvm::outs() << "asm fixme Arg_FrameRelative\n"; | |
assert(0); | |
/* if (arg->expr->op == TOKvar) | |
arg_val = ((VarExp *) arg->expr)->var->toSymbol()->Stree; | |
@@ -275,7 +276,7 @@ | |
break;*/ | |
case Arg_LocalSize: | |
// FIXME | |
-llvm::cout << "asm fixme Arg_LocalSize" << std::endl; | |
+llvm::outs() << "asm fixme Arg_LocalSize\n"; | |
assert(0); | |
/* var_frame_offset = cfun->x_frame_offset; | |
if (var_frame_offset < 0) | |
diff --git a/gen/configfile.cpp b/gen/configfile.cpp | |
--- a/gen/configfile.cpp | |
+++ b/gen/configfile.cpp | |
@@ -109,7 +109,7 @@ | |
} | |
// save config file path for -v output | |
- pathstr = p.toString(); | |
+ pathstr = p.str(); | |
try | |
{ | |
diff --git a/gen/linker.cpp b/gen/linker.cpp | |
--- a/gen/linker.cpp | |
+++ b/gen/linker.cpp | |
@@ -220,7 +220,7 @@ | |
// find gcc for linking | |
llvm::sys::Path gcc = getGcc(); | |
// get a string version for argv[0] | |
- std::string gccStr = gcc.toString(); | |
+ std::string gccStr = gcc.str(); | |
// build arguments | |
std::vector<const char*> args; | |
@@ -371,7 +371,7 @@ | |
// build arguments | |
std::vector<const char*> args; | |
// args[0] should be the name of the executable | |
- args.push_back(gExePath.toString().c_str()); | |
+ args.push_back(gExePath.c_str()); | |
// Skip first argument to -run; it's a D source file. | |
for (size_t i = 1, length = opts::runargs.size(); i < length; i++) | |
{ | |
diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp | |
--- a/gen/llvmhelpers.cpp | |
+++ b/gen/llvmhelpers.cpp | |
@@ -23,6 +23,8 @@ | |
#include "gen/nested.h" | |
#include "ir/irmodule.h" | |
+#include "llvm/Support/raw_ostream.h" | |
+ | |
#include <stack> | |
/****************************************************************************************/ | |
@@ -485,7 +487,7 @@ | |
} | |
// unknown | |
- llvm::cout << "unsupported: null value for " << type->toChars() << '\n'; | |
+ llvm::outs() << "unsupported: null value for " << type->toChars() << '\n'; | |
assert(0); | |
return 0; | |
diff --git a/gen/logger.cpp b/gen/logger.cpp | |
--- a/gen/logger.cpp | |
+++ b/gen/logger.cpp | |
@@ -12,7 +12,7 @@ | |
#include "llvm/GlobalValue.h" | |
#include "llvm/Support/Casting.h" | |
-#include "llvm/Support/raw_ostream.h" | |
+#include "llvm/Support/raw_os_ostream.h" | |
#include "llvm/Assembly/Writer.h" | |
#include "gen/logger.h" | |
@@ -27,10 +27,11 @@ | |
// Constants don't always get their types pretty-printed. | |
// (Only treat non-global constants like this, so that e.g. global variables | |
// still get their initializers printed) | |
+ llvm::raw_os_ostream raw(OS); | |
if (llvm::isa<llvm::Constant>(V) && !llvm::isa<llvm::GlobalValue>(V)) | |
- llvm::WriteAsOperand(OS, &V, true, gIR->module); | |
+ llvm::WriteAsOperand(raw, &V, true, gIR->module); | |
else | |
- OS << V; | |
+ raw << V; | |
} | |
namespace Logger | |
diff --git a/gen/logger.h b/gen/logger.h | |
--- a/gen/logger.h | |
+++ b/gen/logger.h | |
@@ -2,6 +2,7 @@ | |
#define _llvmd_gen_logger_h_ | |
#include <iosfwd> | |
+#include <iostream> | |
namespace llvm { | |
class Type; | |
diff --git a/gen/todebug.cpp b/gen/todebug.cpp | |
--- a/gen/todebug.cpp | |
+++ b/gen/todebug.cpp | |
@@ -515,7 +515,7 @@ | |
if (!FileName::absolute(srcpath.c_str())) { | |
llvm::sys::Path tmp = llvm::sys::Path::GetCurrentDirectory(); | |
tmp.appendComponent(srcpath); | |
- srcpath = tmp.toString(); | |
+ srcpath = tmp.str(); | |
if (!srcpath.empty() && *srcpath.rbegin() != '/' && *srcpath.rbegin() != '\\') | |
srcpath = srcpath + '/'; | |
} | |
diff --git a/gen/toobj.cpp b/gen/toobj.cpp | |
--- a/gen/toobj.cpp | |
+++ b/gen/toobj.cpp | |
@@ -18,7 +18,7 @@ | |
#include "llvm/PassManager.h" | |
#include "llvm/LinkAllPasses.h" | |
#include "llvm/System/Program.h" | |
-#include "llvm/Support/raw_ostream.h" | |
+#include "llvm/Support/raw_os_ostream.h" | |
#include "llvm/Support/CommandLine.h" | |
#include "llvm/Support/FormattedStream.h" | |
#include "llvm/Target/TargetMachine.h" | |
@@ -231,7 +231,8 @@ | |
error("cannot write LLVM bitcode, failed to open file '%s'", bcpath.c_str()); | |
fatal(); | |
} | |
- llvm::WriteBitcodeToFile(m, bos); | |
+ llvm::raw_os_ostream raw(bos); | |
+ llvm::WriteBitcodeToFile(m, raw); | |
} | |
// write LLVM IR | |
@@ -246,7 +247,8 @@ | |
error("cannot write LLVM asm, failed to open file '%s'", llpath.c_str()); | |
fatal(); | |
} | |
- m->print(aos, NULL); | |
+ llvm::raw_os_ostream raw(aos); | |
+ m->print(raw, NULL); | |
} | |
// write native assembly | |
@@ -260,7 +262,7 @@ | |
Logger::println("Writing native asm to: %s\n", spath.c_str()); | |
std::string err; | |
{ | |
- llvm::raw_fd_ostream out(spath.c_str(), false, true, err); | |
+ llvm::raw_fd_ostream out(spath.c_str(), err); | |
if (err.empty()) | |
{ | |
write_asm_to_file(*gTargetMachine, *m, out); | |
@@ -350,14 +352,14 @@ | |
// and linker because we don't know where to put the _start symbol. | |
// GCC mysteriously knows how to do it. | |
std::vector<std::string> args; | |
- args.push_back(gcc.toString()); | |
+ args.push_back(gcc.str()); | |
args.push_back("-fno-strict-aliasing"); | |
args.push_back("-O3"); | |
args.push_back("-c"); | |
args.push_back("-xassembler"); | |
- args.push_back(asmpath.toString()); | |
+ args.push_back(asmpath.str()); | |
args.push_back("-o"); | |
- args.push_back(objpath.toString()); | |
+ args.push_back(objpath.str()); | |
//FIXME: only use this if needed? | |
args.push_back("-fpic"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment