reduce typeToNameMap lookups

This commit is contained in:
Jake Hillion 2023-01-17 07:46:23 -08:00 committed by Jake Hillion
parent a0d2d46c71
commit ece1e579ac

View File

@ -1553,12 +1553,13 @@ bool OICodeGen::enumerateTypesRecurse(drgn_type *type) {
}
std::optional<std::string> OICodeGen::getNameForType(drgn_type *type) {
if (typeToNameMap.find(type) == typeToNameMap.end()) {
if (auto search = typeToNameMap.find(type); search != typeToNameMap.end()) {
return search->second;
}
LOG(ERROR) << "QOO7 Failed to find " << type;
return std::nullopt;
}
return typeToNameMap[type];
}
void OICodeGen::getFuncDefClassMembers(
std::string &code, drgn_type *type,