[llvm-commits] CVS: llvm/lib/VMCore/Type.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Sep 2 17:51:02 PDT 2003


Changes in directory llvm/lib/VMCore:

Type.cpp updated: 1.57 -> 1.58

---
Log message:

Don't return bogus references, and don't add an entry to the Concrete map
unless it's not empty!


---
Diffs of the changes:

Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.57 llvm/lib/VMCore/Type.cpp:1.58
--- llvm/lib/VMCore/Type.cpp:1.57	Tue Sep  2 17:15:15 2003
+++ llvm/lib/VMCore/Type.cpp	Tue Sep  2 17:50:02 2003
@@ -39,7 +39,8 @@
 
 Type::Type(const std::string &name, PrimitiveID id)
   : Value(Type::TypeTy, Value::TypeVal) {
-  ConcreteTypeDescriptions[this] = name;
+  if (!name.empty())
+    ConcreteTypeDescriptions[this] = name;
   ID = id;
   Abstract = false;
   UID = CurUID++;       // Assign types UID's as they are created
@@ -202,8 +203,8 @@
     break;
   }
   default:
-    assert(0 && "Unhandled type in getTypeDescription!");
     Result = "<error>";
+    assert(0 && "Unhandled type in getTypeDescription!");
   }
 
   TypeStack.pop_back();       // Remove self from stack...
@@ -211,11 +212,9 @@
   // In order to reduce the amount of repeated computation, we cache the
   // computed value for later.
   if (Ty->isAbstract())
-    AbstractTypeDescriptions[Ty] = Result;
+    return AbstractTypeDescriptions[Ty] = Result;
   else
-    ConcreteTypeDescriptions[Ty] = Result;
-
-  return Result;
+    return ConcreteTypeDescriptions[Ty] = Result;
 }
 
 





More information about the llvm-commits mailing list