[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp AutoUpgrade.cpp LeakDetector.cpp PassManager.cpp TypeSymbolTable.cpp Verifier.cpp

Bill Wendling isanbard at gmail.com
Mon Nov 27 18:09:18 PST 2006



Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.213 -> 1.214
AutoUpgrade.cpp updated: 1.21 -> 1.22
LeakDetector.cpp updated: 1.15 -> 1.16
PassManager.cpp updated: 1.32 -> 1.33
TypeSymbolTable.cpp updated: 1.3 -> 1.4
Verifier.cpp updated: 1.167 -> 1.168
---
Log message:

Changed to using LLVM streams.


---
Diffs of the changes:  (+34 -35)

 AsmWriter.cpp       |   13 +++++++------
 AutoUpgrade.cpp     |    4 ++--
 LeakDetector.cpp    |   20 ++++++++++----------
 PassManager.cpp     |    5 ++---
 TypeSymbolTable.cpp |   21 ++++++++++-----------
 Verifier.cpp        |    6 +++---
 6 files changed, 34 insertions(+), 35 deletions(-)


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.213 llvm/lib/VMCore/AsmWriter.cpp:1.214
--- llvm/lib/VMCore/AsmWriter.cpp:1.213	Sun Nov 26 19:05:10 2006
+++ llvm/lib/VMCore/AsmWriter.cpp	Mon Nov 27 20:09:03 2006
@@ -26,10 +26,11 @@
 #include "llvm/Instructions.h"
 #include "llvm/Module.h"
 #include "llvm/SymbolTable.h"
-#include "llvm/Support/CFG.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/CFG.h"
 #include "llvm/Support/MathExtras.h"
+#include "llvm/Support/Streams.h"
 #include <algorithm>
 using namespace llvm;
 
@@ -866,7 +867,7 @@
     case GlobalValue::ExternalWeakLinkage: Out << "extern_weak "; break;
     case GlobalValue::ExternalLinkage:     break;
     case GlobalValue::GhostLinkage:
-      std::cerr << "GhostLinkage not allowed in AsmWriter!\n";
+      llvm_cerr << "GhostLinkage not allowed in AsmWriter!\n";
       abort();
     }
 
@@ -965,7 +966,7 @@
     case GlobalValue::ExternalWeakLinkage: Out << "extern_weak "; break;      
     case GlobalValue::ExternalLinkage: break;
     case GlobalValue::GhostLinkage:
-      std::cerr << "GhostLinkage not allowed in AsmWriter!\n";
+      llvm_cerr << "GhostLinkage not allowed in AsmWriter!\n";
       abort();
     }
 
@@ -1358,11 +1359,11 @@
 
 // Value::dump - allow easy printing of  Values from the debugger.
 // Located here because so much of the needed functionality is here.
-void Value::dump() const { print(std::cerr); std::cerr << '\n'; }
+void Value::dump() const { print(std::cerr); llvm_cerr << '\n'; }
 
 // Type::dump - allow easy printing of  Values from the debugger.
 // Located here because so much of the needed functionality is here.
-void Type::dump() const { print(std::cerr); std::cerr << '\n'; }
+void Type::dump() const { print(std::cerr); llvm_cerr << '\n'; }
 
 //===----------------------------------------------------------------------===//
 //  CachedWriter Class Implementation
@@ -1413,7 +1414,7 @@
 //===----------------------------------------------------------------------===//
 
 #if 0
-#define SC_DEBUG(X) std::cerr << X
+#define SC_DEBUG(X) llvm_cerr << X
 #else
 #define SC_DEBUG(X)
 #endif


Index: llvm/lib/VMCore/AutoUpgrade.cpp
diff -u llvm/lib/VMCore/AutoUpgrade.cpp:1.21 llvm/lib/VMCore/AutoUpgrade.cpp:1.22
--- llvm/lib/VMCore/AutoUpgrade.cpp:1.21	Sun Nov 26 19:05:10 2006
+++ llvm/lib/VMCore/AutoUpgrade.cpp	Mon Nov 27 20:09:03 2006
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Assembly/AutoUpgrade.h"
+#include "llvm/Support/Streams.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Function.h"
@@ -19,7 +20,6 @@
 #include "llvm/Instructions.h"
 #include "llvm/Intrinsics.h"
 #include "llvm/SymbolTable.h"
-#include <iostream>
 using namespace llvm;
 
 static Function *getUpgradedUnaryFn(Function *F) {
@@ -193,7 +193,7 @@
   // See if its one of the name's we're interested in.
   if (Function *R = getUpgradedIntrinsic(F)) {
     if (R->getName() != F->getName())
-      std::cerr << "WARNING: change " << F->getName() << " to "
+      llvm_cerr << "WARNING: change " << F->getName() << " to "
                 << R->getName() << "\n";
     return R;
   }


Index: llvm/lib/VMCore/LeakDetector.cpp
diff -u llvm/lib/VMCore/LeakDetector.cpp:1.15 llvm/lib/VMCore/LeakDetector.cpp:1.16
--- llvm/lib/VMCore/LeakDetector.cpp:1.15	Sun Aug 27 07:54:02 2006
+++ llvm/lib/VMCore/LeakDetector.cpp	Mon Nov 27 20:09:03 2006
@@ -11,22 +11,22 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Support/LeakDetector.h"
 #include "llvm/Support/Compiler.h"
+#include "llvm/Support/LeakDetector.h"
+#include "llvm/Support/Streams.h"
 #include "llvm/Value.h"
-#include <iostream>
 #include <set>
 using namespace llvm;
 
 namespace {
   template <class T>
   struct VISIBILITY_HIDDEN PrinterTrait {
-    static void print(const T* P) { std::cerr << P; }
+    static void print(const T* P) { llvm_cerr << P; }
   };
 
   template<>
   struct VISIBILITY_HIDDEN PrinterTrait<Value> {
-    static void print(const Value* P) { std::cerr << *P; }
+    static void print(const Value* P) { llvm_cerr << *P; }
   };
 
   template <typename T>
@@ -59,15 +59,15 @@
       assert(Cache == 0 && "No value should be cached anymore!");
 
       if (!Ts.empty()) {
-        std::cerr
+        llvm_cerr
             << "Leaked " << Name << " objects found: " << Message << ":\n";
         for (typename std::set<const T*>::iterator I = Ts.begin(),
                E = Ts.end(); I != E; ++I) {
-          std::cerr << "\t";
+          llvm_cerr << "\t";
           PrinterTrait<T>::print(*I);
-          std::cerr << "\n";
+          llvm_cerr << "\n";
         }
-        std::cerr << '\n';
+        llvm_cerr << '\n';
 
         return true;
       }
@@ -123,8 +123,8 @@
   // use non-short-circuit version so that both checks are performed
   if (getObjects().hasGarbage(Message) |
       getLLVMObjects().hasGarbage(Message))
-    std::cerr << "\nThis is probably because you removed an object, but didn't "
-                 "delete it.  Please check your code for memory leaks.\n";
+    llvm_cerr << "\nThis is probably because you removed an object, but didn't "
+              << "delete it.  Please check your code for memory leaks.\n";
 
   // Clear out results so we don't get duplicate warnings on
   // next call...


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.32 llvm/lib/VMCore/PassManager.cpp:1.33
--- llvm/lib/VMCore/PassManager.cpp:1.32	Wed Nov 15 13:39:54 2006
+++ llvm/lib/VMCore/PassManager.cpp	Mon Nov 27 20:09:03 2006
@@ -15,10 +15,9 @@
 #include "llvm/PassManager.h"
 #include "llvm/Module.h"
 #include "llvm/ModuleProvider.h"
+#include "llvm/Support/Streams.h"
 #include <vector>
 #include <map>
-#include <iostream>
-
 using namespace llvm;
 
 namespace llvm {
@@ -443,7 +442,7 @@
 bool FunctionPassManager_New::run(Function &F) {
   std::string errstr;
   if (MP->materializeFunction(&F, &errstr)) {
-    std::cerr << "Error reading bytecode file: " << errstr << "\n";
+    llvm_cerr << "Error reading bytecode file: " << errstr << "\n";
     abort();
   }
   return FPM->runOnFunction(F);


Index: llvm/lib/VMCore/TypeSymbolTable.cpp
diff -u llvm/lib/VMCore/TypeSymbolTable.cpp:1.3 llvm/lib/VMCore/TypeSymbolTable.cpp:1.4
--- llvm/lib/VMCore/TypeSymbolTable.cpp:1.3	Wed Jan 11 10:21:23 2006
+++ llvm/lib/VMCore/TypeSymbolTable.cpp	Mon Nov 27 20:09:03 2006
@@ -14,9 +14,8 @@
 #include "llvm/TypeSymbolTable.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/ADT/StringExtras.h"
-#include <iostream>
+#include "llvm/Support/Streams.h"
 #include <algorithm>
-
 using namespace llvm;
 
 #define DEBUG_SYMBOL_TABLE 0
@@ -67,7 +66,7 @@
 
 #if DEBUG_SYMBOL_TABLE
   dump();
-  std::cerr << " Removing Value: " << Result->getName() << "\n";
+  llvm_cerr << " Removing Value: " << Result->getName() << "\n";
 #endif
 
   tmap.erase(Entry);
@@ -76,7 +75,7 @@
   // list...
   if (Result->isAbstract()) {
 #if DEBUG_ABSTYPE
-    std::cerr << "Removing abstract type from symtab" << Result->getDescription()<<"\n";
+    llvm_cerr << "Removing abstract type from symtab" << Result->getDescription()<<"\n";
 #endif
     cast<DerivedType>(Result)->removeAbstractTypeUser(this);
   }
@@ -96,7 +95,7 @@
 
 #if DEBUG_SYMBOL_TABLE
   dump();
-  std::cerr << " Inserting type: " << UniqueName << ": "
+  llvm_cerr << " Inserting type: " << UniqueName << ": "
             << T->getDescription() << "\n";
 #endif
 
@@ -107,7 +106,7 @@
   if (T->isAbstract()) {
     cast<DerivedType>(T)->addAbstractTypeUser(this);
 #if DEBUG_ABSTYPE
-    std::cerr << "Added abstract type to ST: " << T->getDescription() << "\n";
+    llvm_cerr << "Added abstract type to ST: " << T->getDescription() << "\n";
 #endif
   }
 }
@@ -153,14 +152,14 @@
   for (iterator I = begin(), E = end(); I != E; ++I) {
     if (I->second == (Type*)OldType) {  // FIXME when Types aren't const.
 #if DEBUG_ABSTYPE
-      std::cerr << "Removing type " << OldType->getDescription() << "\n";
+      llvm_cerr << "Removing type " << OldType->getDescription() << "\n";
 #endif
       OldType->removeAbstractTypeUser(this);
 
       I->second = (Type*)NewType;  // TODO FIXME when types aren't const
       if (NewType->isAbstract()) {
 #if DEBUG_ABSTYPE
-        std::cerr << "Added type " << NewType->getDescription() << "\n";
+        llvm_cerr << "Added type " << NewType->getDescription() << "\n";
 #endif
         cast<DerivedType>(NewType)->addAbstractTypeUser(this);
       }
@@ -180,13 +179,13 @@
 }
 
 static void DumpTypes(const std::pair<const std::string, const Type*>& T ) {
-  std::cerr << "  '" << T.first << "' = ";
+  llvm_cerr << "  '" << T.first << "' = ";
   T.second->dump();
-  std::cerr << "\n";
+  llvm_cerr << "\n";
 }
 
 void TypeSymbolTable::dump() const {
-  std::cerr << "TypeSymbolPlane: ";
+  llvm_cerr << "TypeSymbolPlane: ";
   for_each(tmap.begin(), tmap.end(), DumpTypes);
 }
 


Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.167 llvm/lib/VMCore/Verifier.cpp:1.168
--- llvm/lib/VMCore/Verifier.cpp:1.167	Sun Nov 26 19:05:10 2006
+++ llvm/lib/VMCore/Verifier.cpp	Mon Nov 27 20:09:03 2006
@@ -55,11 +55,11 @@
 #include "llvm/Analysis/Dominators.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/InstVisitor.h"
+#include "llvm/Support/Streams.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Compiler.h"
 #include <algorithm>
-#include <iostream>
 #include <sstream>
 #include <cstdarg>
 using namespace llvm;
@@ -156,11 +156,11 @@
         switch (action) {
           case AbortProcessAction:
             msgs << "compilation aborted!\n";
-            std::cerr << msgs.str();
+            llvm_cerr << msgs.str();
             abort();
           case PrintMessageAction:
             msgs << "verification continues.\n";
-            std::cerr << msgs.str();
+            llvm_cerr << msgs.str();
             return false;
           case ReturnStatusAction:
             msgs << "compilation terminated.\n";






More information about the llvm-commits mailing list