Fix XCoreTargetLowering::isLegalAddressingMode() to handle VoidTy.
[oota-llvm.git] / lib / VMCore / TypeSymbolTable.cpp
index 3440a7794697060f025519ac4d96d4a64288f5ee..b4daf0f63144ff092ee2ed4f1721f92539770250 100644 (file)
@@ -15,6 +15,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
@@ -31,7 +32,7 @@ TypeSymbolTable::~TypeSymbolTable() {
   }
 }
 
-std::string TypeSymbolTable::getUniqueName(const StringRef &BaseName) const {
+std::string TypeSymbolTable::getUniqueName(StringRef BaseName) const {
   std::string TryName = BaseName;
   
   const_iterator End = tmap.end();
@@ -43,7 +44,7 @@ std::string TypeSymbolTable::getUniqueName(const StringRef &BaseName) const {
 }
 
 // lookup a type by name - returns null on failure
-Type* TypeSymbolTable::lookup(const StringRef &Name) const {
+Type* TypeSymbolTable::lookup(StringRef Name) const {
   const_iterator TI = tmap.find(Name);
   Type* result = 0;
   if (TI != tmap.end())
@@ -51,7 +52,6 @@ Type* TypeSymbolTable::lookup(const StringRef &Name) const {
   return result;
 }
 
-
 // remove - Remove a type from the symbol table...
 Type* TypeSymbolTable::remove(iterator Entry) {
   assert(Entry != tmap.end() && "Invalid entry to remove!");
@@ -59,7 +59,7 @@ Type* TypeSymbolTable::remove(iterator Entry) {
 
 #if DEBUG_SYMBOL_TABLE
   dump();
-  errs() << " Removing Value: " << Result->getDescription() << "\n";
+  dbgs() << " Removing Value: " << Result->getDescription() << "\n";
 #endif
 
   tmap.erase(Entry);
@@ -68,7 +68,7 @@ Type* TypeSymbolTable::remove(iterator Entry) {
   // list...
   if (Result->isAbstract()) {
 #if DEBUG_ABSTYPE
-    errs() << "Removing abstract type from symtab"
+    dbgs() << "Removing abstract type from symtab"
            << Result->getDescription()
            << "\n";
 #endif
@@ -80,7 +80,7 @@ Type* TypeSymbolTable::remove(iterator Entry) {
 
 
 // insert - Insert a type into the symbol table with the specified name...
-void TypeSymbolTable::insert(const StringRef &Name, const Type* T) {
+void TypeSymbolTable::insert(StringRef Name, const Type* T) {
   assert(T && "Can't insert null type into symbol table!");
 
   if (tmap.insert(std::make_pair(Name, T)).second) {
@@ -88,7 +88,7 @@ void TypeSymbolTable::insert(const StringRef &Name, const Type* T) {
     
 #if DEBUG_SYMBOL_TABLE
     dump();
-    errs() << " Inserted type: " << Name << ": " << T->getDescription() << "\n";
+    dbgs() << " Inserted type: " << Name << ": " << T->getDescription() << "\n";
 #endif
   } else {
     // If there is a name conflict...
@@ -100,7 +100,7 @@ void TypeSymbolTable::insert(const StringRef &Name, const Type* T) {
     
 #if DEBUG_SYMBOL_TABLE
     dump();
-    errs() << " Inserting type: " << UniqueName << ": "
+    dbgs() << " Inserting type: " << UniqueName << ": "
            << T->getDescription() << "\n";
 #endif
 
@@ -112,7 +112,7 @@ void TypeSymbolTable::insert(const StringRef &Name, const Type* T) {
   if (T->isAbstract()) {
     cast<DerivedType>(T)->addAbstractTypeUser(this);
 #if DEBUG_ABSTYPE
-    errs() << "Added abstract type to ST: " << T->getDescription() << "\n";
+    dbgs() << "Added abstract type to ST: " << T->getDescription() << "\n";
 #endif
   }
 }
@@ -128,14 +128,14 @@ void TypeSymbolTable::refineAbstractType(const DerivedType *OldType,
   for (iterator I = begin(), E = end(); I != E; ++I) {
     if (I->second == (Type*)OldType) {  // FIXME when Types aren't const.
 #if DEBUG_ABSTYPE
-      errs() << "Removing type " << OldType->getDescription() << "\n";
+      dbgs() << "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
-        errs() << "Added type " << NewType->getDescription() << "\n";
+        dbgs() << "Added type " << NewType->getDescription() << "\n";
 #endif
         cast<DerivedType>(NewType)->addAbstractTypeUser(this);
       }
@@ -155,13 +155,13 @@ void TypeSymbolTable::typeBecameConcrete(const DerivedType *AbsTy) {
 }
 
 static void DumpTypes(const std::pair<const std::string, const Type*>& T ) {
-  errs() << "  '" << T.first << "' = ";
+  dbgs() << "  '" << T.first << "' = ";
   T.second->dump();
-  errs() << "\n";
+  dbgs() << "\n";
 }
 
 void TypeSymbolTable::dump() const {
-  errs() << "TypeSymbolPlane: ";
+  dbgs() << "TypeSymbolPlane: ";
   for_each(tmap.begin(), tmap.end(), DumpTypes);
 }