[llvm-commits] CVS: llvm/tools/lto/lto.cpp

Bill Wendling isanbard at gmail.com
Tue Nov 28 16:20:24 PST 2006



Changes in directory llvm/tools/lto:

lto.cpp updated: 1.25 -> 1.26
---
Log message:

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.


---
Diffs of the changes:  (+10 -8)

 lto.cpp |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)


Index: llvm/tools/lto/lto.cpp
diff -u llvm/tools/lto/lto.cpp:1.25 llvm/tools/lto/lto.cpp:1.26
--- llvm/tools/lto/lto.cpp:1.25	Thu Oct 26 15:46:22 2006
+++ llvm/tools/lto/lto.cpp	Tue Nov 28 18:19:40 2006
@@ -37,10 +37,10 @@
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Analysis/LoadValueNumbering.h"
 #include "llvm/Support/MathExtras.h"
+#include "llvm/Support/Streams.h"
 #include "llvm/LinkTimeOptimizer.h"
 #include <fstream>
-#include <iostream>
-
+#include <ostream>
 using namespace llvm;
 
 extern "C"
@@ -361,7 +361,8 @@
     std::string tempFileName(FinalOutputPath.c_str());
     tempFileName += "0.bc";
     std::ofstream Out(tempFileName.c_str(), io_mode);
-    WriteBytecodeToFile(bigOne, Out, true);
+    llvm_ostream L(Out);
+    WriteBytecodeToFile(bigOne, L, true);
   }
 
   // Strip leading underscore because it was added to match names
@@ -377,17 +378,17 @@
   std::string ErrMsg;
   sys::Path TempDir = sys::Path::GetTemporaryDirectory(&ErrMsg);
   if (TempDir.isEmpty()) {
-    std::cerr << "lto: " << ErrMsg << "\n";
+    llvm_cerr << "lto: " << ErrMsg << "\n";
     return LTO_WRITE_FAILURE;
   }
   sys::Path tmpAsmFilePath(TempDir);
   if (!tmpAsmFilePath.appendComponent("lto")) {
-    std::cerr << "lto: " << ErrMsg << "\n";
+    llvm_cerr << "lto: " << ErrMsg << "\n";
     TempDir.eraseFromDisk(true);
     return LTO_WRITE_FAILURE;
   }
   if (tmpAsmFilePath.createTemporaryFileOnDisk(&ErrMsg)) {
-    std::cerr << "lto: " << ErrMsg << "\n";
+    llvm_cerr << "lto: " << ErrMsg << "\n";
     TempDir.eraseFromDisk(true);
     return LTO_WRITE_FAILURE;
   }
@@ -414,7 +415,8 @@
     std::string tempFileName(FinalOutputPath.c_str());
     tempFileName += "1.bc";
     std::ofstream Out(tempFileName.c_str(), io_mode);
-    WriteBytecodeToFile(bigOne, Out, true);
+    llvm_ostream L(Out);
+    WriteBytecodeToFile(bigOne, L, true);
   }
 
   targetTriple = bigOne->getTargetTriple();
@@ -443,7 +445,7 @@
   args.push_back(0);
 
   if (sys::Program::ExecuteAndWait(gcc, &args[0], 0, 0, 1, &ErrMsg)) {
-    std::cerr << "lto: " << ErrMsg << "\n";
+    llvm_cerr << "lto: " << ErrMsg << "\n";
     return LTO_ASM_FAILURE;
   }
 






More information about the llvm-commits mailing list