aboutsummaryrefslogtreecommitdiffstats
path: root/tools/gccld
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2006-11-29 00:19:40 +0000
committerBill Wendling <isanbard@gmail.com>2006-11-29 00:19:40 +0000
commit68fe61d6a165ea6090008e281330895a21607daf (patch)
tree2e0cc1cbd16099aed908dbb3ecda16cf57d04300 /tools/gccld
parenta5b31ca85686062408bca0f0a8aa43f9fe58e644 (diff)
downloadexternal_llvm-68fe61d6a165ea6090008e281330895a21607daf.zip
external_llvm-68fe61d6a165ea6090008e281330895a21607daf.tar.gz
external_llvm-68fe61d6a165ea6090008e281330895a21607daf.tar.bz2
Replacing std::iostreams with llvm iostreams. Some of these changes involve
adding a temporary wrapper around the ostream to make it friendly to functions expecting an LLVM stream. This should be fixed in the future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31990 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gccld')
-rw-r--r--tools/gccld/GenerateCode.cpp11
-rw-r--r--tools/gccld/gccld.cpp35
2 files changed, 24 insertions, 22 deletions
diff --git a/tools/gccld/GenerateCode.cpp b/tools/gccld/GenerateCode.cpp
index e28f4c9..c84c7d36 100644
--- a/tools/gccld/GenerateCode.cpp
+++ b/tools/gccld/GenerateCode.cpp
@@ -27,7 +27,7 @@
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/SystemUtils.h"
#include "llvm/Support/CommandLine.h"
-
+#include "llvm/Support/Streams.h"
using namespace llvm;
namespace {
@@ -123,10 +123,10 @@ static void RemoveEnv(const char * name, char ** const envp) {
}
static void dumpArgs(const char **args) {
- std::cerr << *args++;
+ llvm_cerr << *args++;
while (*args)
- std::cerr << ' ' << *args++;
- std::cerr << '\n' << std::flush;
+ llvm_cerr << ' ' << *args++;
+ llvm_cerr << '\n' << std::flush;
}
static inline void addPass(PassManager &PM, Pass *P) {
@@ -283,7 +283,8 @@ int llvm::GenerateBytecode(Module *M, int StripLevel, bool Internalize,
Passes.add(createVerifierPass());
// Add the pass that writes bytecode to the output file...
- addPass(Passes, new WriteBytecodePass(Out, false, !NoCompress));
+ llvm_ostream L(*Out);
+ addPass(Passes, new WriteBytecodePass(&L, false, !NoCompress));
// Run our queue of passes all at once now, efficiently.
Passes.run(*M);
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp
index 9401a8a..5376425 100644
--- a/tools/gccld/gccld.cpp
+++ b/tools/gccld/gccld.cpp
@@ -31,6 +31,7 @@
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileUtilities.h"
+#include "llvm/Support/Streams.h"
#include "llvm/System/Signals.h"
#include "llvm/Support/SystemUtils.h"
#include <fstream>
@@ -126,7 +127,7 @@ namespace {
/// Message - The message to print to standard error.
///
static int PrintAndReturn(const char *progname, const std::string &Message) {
- std::cerr << progname << ": " << Message << "\n";
+ llvm_cerr << progname << ": " << Message << "\n";
return 1;
}
@@ -140,11 +141,11 @@ static void EmitShellScript(char **argv) {
std::string ErrMsg;
sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0]);
if (llvmstub.isEmpty()) {
- std::cerr << "Could not find llvm-stub.exe executable!\n";
+ llvm_cerr << "Could not find llvm-stub.exe executable!\n";
exit(1);
}
if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg)) {
- std::cerr << argv[0] << ": " << ErrMsg << "\n";
+ llvm_cerr << argv[0] << ": " << ErrMsg << "\n";
exit(1);
}
@@ -324,18 +325,18 @@ int main(int argc, char **argv, char **envp ) {
return PrintAndReturn(argv[0], "Failed to find gcc");
// Generate an assembly language file for the bytecode.
- if (Verbose) std::cout << "Generating Assembly Code\n";
+ if (Verbose) llvm_cout << "Generating Assembly Code\n";
std::string ErrMsg;
if (0 != GenerateAssembly(
AssemblyFile.toString(), RealBytecodeOutput, llc, ErrMsg, Verbose)) {
- std::cerr << argv[0] << ": " << ErrMsg << "\n";
+ llvm_cerr << argv[0] << ": " << ErrMsg << "\n";
return 2;
}
- if (Verbose) std::cout << "Generating Native Code\n";
+ if (Verbose) llvm_cout << "Generating Native Code\n";
if (0 != GenerateNative(OutputFilename, AssemblyFile.toString(),
LibPaths, Libraries, gcc, envp, LinkAsLibrary,
NoInternalize, RPath, SOName, ErrMsg, Verbose) ) {
- std::cerr << argv[0] << ": " << ErrMsg << "\n";
+ llvm_cerr << argv[0] << ": " << ErrMsg << "\n";
return 2;
}
@@ -364,18 +365,18 @@ int main(int argc, char **argv, char **envp ) {
return PrintAndReturn(argv[0], "Failed to find gcc");
// Generate an assembly language file for the bytecode.
- if (Verbose) std::cout << "Generating C Source Code\n";
+ if (Verbose) llvm_cout << "Generating C Source Code\n";
std::string ErrMsg;
if (0 != GenerateCFile(
CFile.toString(), RealBytecodeOutput, llc, ErrMsg, Verbose)) {
- std::cerr << argv[0] << ": " << ErrMsg << "\n";
+ llvm_cerr << argv[0] << ": " << ErrMsg << "\n";
return 2;
}
- if (Verbose) std::cout << "Generating Native Code\n";
+ if (Verbose) llvm_cout << "Generating Native Code\n";
if (0 != GenerateNative(OutputFilename, CFile.toString(),
LibPaths, Libraries, gcc, envp, LinkAsLibrary,
NoInternalize, RPath, SOName, ErrMsg, Verbose)) {
- std::cerr << argv[0] << ": " << ErrMsg << "\n";
+ llvm_cerr << argv[0] << ": " << ErrMsg << "\n";
return 2;
}
@@ -392,11 +393,11 @@ int main(int argc, char **argv, char **envp ) {
// Make the bytecode file readable and directly executable in LLEE
std::string ErrMsg;
if (sys::Path(RealBytecodeOutput).makeExecutableOnDisk(&ErrMsg)) {
- std::cerr << argv[0] << ": " << ErrMsg << "\n";
+ llvm_cerr << argv[0] << ": " << ErrMsg << "\n";
return 1;
}
if (sys::Path(RealBytecodeOutput).makeReadableOnDisk(&ErrMsg)) {
- std::cerr << argv[0] << ": " << ErrMsg << "\n";
+ llvm_cerr << argv[0] << ": " << ErrMsg << "\n";
return 1;
}
}
@@ -404,18 +405,18 @@ int main(int argc, char **argv, char **envp ) {
// Make the output, whether native or script, executable as well...
std::string ErrMsg;
if (sys::Path(OutputFilename).makeExecutableOnDisk(&ErrMsg)) {
- std::cerr << argv[0] << ": " << ErrMsg << "\n";
+ llvm_cerr << argv[0] << ": " << ErrMsg << "\n";
return 1;
}
} catch (const char*msg) {
- std::cerr << argv[0] << ": " << msg << "\n";
+ llvm_cerr << argv[0] << ": " << msg << "\n";
exitCode = 1;
} catch (const std::string& msg) {
- std::cerr << argv[0] << ": " << msg << "\n";
+ llvm_cerr << argv[0] << ": " << msg << "\n";
exitCode = 2;
} catch (...) {
// This really shouldn't happen, but just in case ....
- std::cerr << argv[0] << ": An unexpected unknown exception occurred.\n";
+ llvm_cerr << argv[0] << ": An unexpected unknown exception occurred.\n";
exitCode = 3;
}