[llvm] r305617 - Don't crash if a type record can't be found.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 16 17:02:24 PDT 2017


Author: zturner
Date: Fri Jun 16 19:02:24 2017
New Revision: 305617

URL: http://llvm.org/viewvc/llvm-project?rev=305617&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp

Modified: llvm/trunk/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp?rev=305617&r1=305616&r2=305617&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp Fri Jun 16 19:02:24 2017
@@ -75,6 +75,15 @@ StringRef LazyRandomTypeCollection::getT
   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);




More information about the llvm-commits mailing list