From ece1e579acd809f53b2c07218e873d66ce425758 Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Tue, 17 Jan 2023 07:46:23 -0800 Subject: [PATCH] reduce typeToNameMap lookups --- src/OICodeGen.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/OICodeGen.cpp b/src/OICodeGen.cpp index 14b8726..4ae2d2f 100644 --- a/src/OICodeGen.cpp +++ b/src/OICodeGen.cpp @@ -1553,11 +1553,12 @@ bool OICodeGen::enumerateTypesRecurse(drgn_type *type) { } std::optional OICodeGen::getNameForType(drgn_type *type) { - if (typeToNameMap.find(type) == typeToNameMap.end()) { - LOG(ERROR) << "QOO7 Failed to find " << type; - return std::nullopt; + if (auto search = typeToNameMap.find(type); search != typeToNameMap.end()) { + return search->second; } - return typeToNameMap[type]; + + LOG(ERROR) << "QOO7 Failed to find " << type; + return std::nullopt; } void OICodeGen::getFuncDefClassMembers(