summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-06-17 00:02:24 +0000
committerZachary Turner <zturner@google.com>2017-06-17 00:02:24 +0000
commitb0fdd214b76336c8638a27b593f9894e90bae42a (patch)
tree27e9ad4737767fa62f9cec320ab7f2d388ebf606 /llvm/lib/DebugInfo
parent9d24fb7ff318d7a88f0fa3e63eb0df4acafd9805 (diff)
downloadbcm5719-llvm-b0fdd214b76336c8638a27b593f9894e90bae42a.tar.gz
bcm5719-llvm-b0fdd214b76336c8638a27b593f9894e90bae42a.zip
Don't crash if a type record can't be found.
This was a regression introduced in a previous patch. Adding back the code that handles this case. llvm-svn: 305617
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp b/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp
index 9b5871e7eaf..551963ea306 100644
--- a/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp
+++ b/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp
@@ -75,6 +75,15 @@ StringRef LazyRandomTypeCollection::getTypeName(TypeIndex Index) {
if (Index.isNoneType() || Index.isSimple())
return TypeIndex::simpleTypeName(Index);
+ // Try to make sure the type exists. Even if it doesn't though, it may be
+ // because we're dumping a symbol stream with no corresponding type stream
+ // present, in which case we still want to be able to print <unknown UDT>
+ // for the type names.
+ if (auto EC = ensureTypeExists(Index)) {
+ consumeError(std::move(EC));
+ return "<unknown UDT>";
+ }
+
uint32_t I = Index.toArrayIndex();
if (I >= TypeNames.size())
TypeNames.resize(I + 1);
OpenPOWER on IntegriCloud