1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

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
This commit is contained in:
Zachary Turner 2017-06-17 00:02:24 +00:00
parent 9f1012760e
commit d2d96834f2

View File

@ -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);