[llvm-commits] [llvm-gcc-4.2] r65719 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-types.cpp

Chris Lattner sabre at nondot.org
Sat Feb 28 13:04:54 PST 2009


Author: lattner
Date: Sat Feb 28 15:04:53 2009
New Revision: 65719

URL: http://llvm.org/viewvc/llvm-project?rev=65719&view=rev
Log:
switch some stuff from std::ostream to raw_ostream.


Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=65719&r1=65718&r2=65719&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Sat Feb 28 15:04:53 2009
@@ -1700,7 +1700,12 @@
 void print_llvm_type(FILE *file, void *LLVM) {
   oFILEstream FS(file);
   FS << "LLVM: ";
-  WriteTypeSymbolic(FS, (const Type*)LLVM, TheModule);
+  
+  // FIXME: oFILEstream can probably be removed in favor of a new raw_ostream
+  // adaptor which would be simpler and more efficient.  In the meantime, just
+  // adapt the adaptor.
+  raw_os_ostream RO(FS);
+  WriteTypeSymbolic(RO, (const Type*)LLVM, TheModule);
 }
 
 // Get a register name given its decl.  In 4.2 unlike 4.0 these names

Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=65719&r1=65718&r2=65719&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Sat Feb 28 15:04:53 2009
@@ -35,7 +35,7 @@
 #include "llvm/Assembly/Writer.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringExtras.h"
-#include <iostream>
+#include "llvm/Support/raw_ostream.h"
 #include <map>
 
 extern "C" {
@@ -498,7 +498,8 @@
   AbsTy->removeAbstractTypeUser(this);
 }
 void TypeRefinementDatabase::dump() const {
-  std::cerr << "TypeRefinementDatabase\n";
+  outs() << "TypeRefinementDatabase\n";
+  outs().flush();
 }
 
 //===----------------------------------------------------------------------===//
@@ -1622,14 +1623,16 @@
 }
 
 void StructTypeConversionInfo::dump() const {
-  std::cerr << "Info has " << Elements.size() << " fields:\n";
+  raw_ostream &OS = outs();
+  OS << "Info has " << Elements.size() << " fields:\n";
   for (unsigned i = 0, e = Elements.size(); i != e; ++i) {
-    std::cerr << "  Offset = " << ElementOffsetInBytes[i]
-              << " Size = " << ElementSizeInBytes[i]
-              << " Type = ";
-    WriteTypeSymbolic(std::cerr, Elements[i], TheModule);
-    std::cerr << "\n";
+    OS << "  Offset = " << ElementOffsetInBytes[i]
+       << " Size = " << ElementSizeInBytes[i]
+       << " Type = ";
+    WriteTypeSymbolic(OS, Elements[i], TheModule);
+    OS << "\n";
   }
+  OS.flush();
 }
 
 std::map<tree, StructTypeConversionInfo *> StructTypeInfoMap;





More information about the llvm-commits mailing list