Change WriteTypeSymbolic to not put a space out before types, also, remove
authorChris Lattner <sabre@nondot.org>
Sat, 28 Feb 2009 21:05:51 +0000 (21:05 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 28 Feb 2009 21:05:51 +0000 (21:05 +0000)
the old std::ostream version.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65720 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Assembly/Writer.h
lib/Analysis/IPA/FindUsedTypes.cpp
lib/VMCore/AsmWriter.cpp
lib/VMCore/Verifier.cpp

index c9f8edb352431c538dda8c85e9afa96f7a9a9b43..8e79b272b0841cfda4234815ea7a0b390c2b9d00 100644 (file)
@@ -27,10 +27,9 @@ class Value;
 class raw_ostream;
 
 // WriteTypeSymbolic - This attempts to write the specified type as a symbolic
-// type, iff there is an entry in the Module's symbol table for the specified
-// type or one of its component types.  This is slower than a simple x << Type;
+// type, if there is an entry in the Module's symbol table for the specified
+// type or one of its component types.
 //
-void WriteTypeSymbolic(std::ostream &, const Type *, const Module *M);
 void WriteTypeSymbolic(raw_ostream &, const Type *, const Module *M);
 
 // WriteAsOperand - Write the name of the specified value out to the specified
index 88a180ae5213a6f22dd7361401d11f3b60a84370..920ee374555f7cf6027eff25f5a42c2853f3598a 100644 (file)
@@ -19,6 +19,7 @@
 #include "llvm/Module.h"
 #include "llvm/Assembly/Writer.h"
 #include "llvm/Support/InstIterator.h"
+#include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
 char FindUsedTypes::ID = 0;
@@ -91,11 +92,13 @@ bool FindUsedTypes::runOnModule(Module &m) {
 // passed in, then the types are printed symbolically if possible, using the
 // symbol table from the module.
 //
-void FindUsedTypes::print(std::ostream &o, const Module *M) const {
-  o << "Types in use by this module:\n";
+void FindUsedTypes::print(std::ostream &OS, const Module *M) const {
+  raw_os_ostream RO(OS);
+  RO << "Types in use by this module:\n";
   for (std::set<const Type *>::const_iterator I = UsedTypes.begin(),
        E = UsedTypes.end(); I != E; ++I) {
-    WriteTypeSymbolic(o << "  ", *I, M);
-    o << "\n";
+    RO << "   ";
+    WriteTypeSymbolic(RO, *I, M);
+    RO << '\n';
   }
 }
index 7a4dcbce800f56dcb6b9c9a9bcf5633e7b747e76..bd3f0b7df9562966d79e65ec3bd15a2a12f29ebc 100644 (file)
@@ -259,7 +259,7 @@ void TypePrinting::CalcTypeName(const Type *Ty,
   }
   case Type::ArrayTyID: {
     const ArrayType *ATy = cast<ArrayType>(Ty);
-    Result << "[" << ATy->getNumElements() << " x ";
+    Result << '[' << ATy->getNumElements() << " x ";
     CalcTypeName(ATy->getElementType(), TypeStack, Result);
     Result << ']';
     break;
@@ -307,8 +307,6 @@ void TypePrinting::print(const Type *Ty) {
   std::string TypeName;
   
   raw_string_ostream TypeOS(TypeName);
-
-  
   CalcTypeName(Ty, TypeStack, TypeOS);
   OS << TypeOS.str();
 
@@ -340,23 +338,12 @@ void TypePrinting::printAtLeastOneLevel(const Type *Ty) {
 
 /// WriteTypeSymbolic - This attempts to write the specified type as a symbolic
 /// type, iff there is an entry in the modules symbol table for the specified
-/// type or one of it's component types. This is slower than a simple x << Type
+/// type or one of it's component types.
 ///
 void llvm::WriteTypeSymbolic(raw_ostream &Out, const Type *Ty, const Module *M){
-  // FIXME: Remove this space.
-  Out << ' ';
-  
   TypePrinting(M, Out).print(Ty);
 }
 
-// std::ostream adaptor.
-void llvm::WriteTypeSymbolic(std::ostream &Out, const Type *Ty,
-                             const Module *M) {
-  raw_os_ostream RO(Out);
-  WriteTypeSymbolic(RO, Ty, M);
-}
-
-
 //===----------------------------------------------------------------------===//
 // SlotTracker Class: Enumerate slot numbers for unnamed values
 //===----------------------------------------------------------------------===//
@@ -1712,9 +1699,6 @@ void Value::print(std::ostream &O, AssemblyAnnotationWriter *AAW) const {
 // Value::dump - allow easy printing of Values from the debugger.
 void Value::dump() const { print(errs()); errs() << '\n'; errs().flush(); }
 
-// Type::dump - allow easy printing of Types from the debugger.
-void Type::dump() const { print(errs()); errs() << '\n'; errs().flush(); }
-
 // Type::dump - allow easy printing of Types from the debugger.
 // This one uses type names from the given context module
 void Type::dump(const Module *Context) const {
@@ -1723,6 +1707,10 @@ void Type::dump(const Module *Context) const {
   errs().flush();
 }
 
+// Type::dump - allow easy printing of Types from the debugger.
+void Type::dump() const { dump(0); }
+
+
 // Module::dump() - Allow printing of Modules from the debugger.
 void Module::dump() const { print(errs(), 0); errs().flush(); }
 
index 99a5b92e5ffbbfd6c1249e16722102b30ff0f0a4..784a66fa09d8ddcb53a39a6b018a42618259ec8d 100644 (file)
@@ -61,6 +61,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Compiler.h"
+#include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 #include <sstream>
 #include <cstdarg>
@@ -290,8 +291,10 @@ namespace {
     }
 
     void WriteType(const Type *T) {
-      if ( !T ) return;
-      WriteTypeSymbolic(msgs, T, Mod );
+      if (!T) return;
+      raw_os_ostream RO(msgs);
+      RO << ' ';
+      WriteTypeSymbolic(RO, T, Mod);
     }