incomplete: handle drgn returning a nullptr name

This commit is contained in:
Jake Hillion 2023-10-30 09:18:09 -07:00 committed by Jake Hillion
parent 4563cbe713
commit 6f623e95a4

View File

@ -125,12 +125,14 @@ Type& DrgnParser::enumerateType(struct drgn_type* type) {
} catch (const DrgnParserError& e) { } catch (const DrgnParserError& e) {
depth_--; depth_--;
if (isTypeIncomplete) { if (isTypeIncomplete) {
const char* typeName = "<incomplete>"; const char* typeName = nullptr;
if (drgn_type_has_name(type)) { if (drgn_type_has_name(type)) {
typeName = drgn_type_name(type); typeName = drgn_type_name(type);
} else if (drgn_type_has_tag(type)) { } else if (drgn_type_has_tag(type)) {
typeName = drgn_type_tag(type); typeName = drgn_type_tag(type);
} }
if (typeName == nullptr)
typeName = "<incomplete>";
return makeType<Incomplete>(nullptr, typeName); return makeType<Incomplete>(nullptr, typeName);
} else { } else {