From 824edbed01e298a5a9efe6a752b5f98f182d99b7 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Sat, 17 Jun 2017 00:02:24 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305617 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp b/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp index 9b5871e7eaf..551963ea306 100644 --- a/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp +++ b/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 + // for the type names. + if (auto EC = ensureTypeExists(Index)) { + consumeError(std::move(EC)); + return ""; + } + uint32_t I = Index.toArrayIndex(); if (I >= TypeNames.size()) TypeNames.resize(I + 1); -- 2.50.1