diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp index 67aa71027687a..97214948d014a 100644 --- a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp @@ -268,10 +268,9 @@ class LVStringRecords { void add(TypeIndex TI, StringRef String) { static uint32_t Index = 0; - if (Strings.find(TI) == Strings.end()) - Strings.emplace( - std::piecewise_construct, std::forward_as_tuple(TI), - std::forward_as_tuple(++Index, std::string(String), nullptr)); + auto [It, Inserted] = Strings.try_emplace(TI); + if (Inserted) + It->second = std::make_tuple(++Index, std::string(String), nullptr); } StringRef find(TypeIndex TI) {