summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-09-02 22:50:02 +0000
committerChris Lattner <sabre@nondot.org>2003-09-02 22:50:02 +0000
commit188afa5feb6cb28d567668b4f350c3723be293c6 (patch)
tree46d706ccfadca8cab3b125ab4492571b00619d57
parent39e5095c8e9bca3f3de2b7a41d7683b5389f5bea (diff)
downloadbcm5719-llvm-188afa5feb6cb28d567668b4f350c3723be293c6.tar.gz
bcm5719-llvm-188afa5feb6cb28d567668b4f350c3723be293c6.zip
Don't return bogus references, and don't add an entry to the Concrete map
unless it's not empty! llvm-svn: 8334
-rw-r--r--llvm/lib/VMCore/Type.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/VMCore/Type.cpp b/llvm/lib/VMCore/Type.cpp
index 5475a571889..54fe4431bab 100644
--- a/llvm/lib/VMCore/Type.cpp
+++ b/llvm/lib/VMCore/Type.cpp
@@ -39,7 +39,8 @@ void PATypeHolder::dump() const {
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 @@ static std::string getTypeDescription(const Type *Ty,
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 @@ static std::string getTypeDescription(const Type *Ty,
// 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;
}
OpenPOWER on IntegriCloud