[llvm-remarkutil] Simplify code with std::map::operator[] (NFC) (#111407)
diff --git a/llvm/tools/llvm-remarkutil/RemarkCounter.cpp b/llvm/tools/llvm-remarkutil/RemarkCounter.cpp
index dc0685f..2d9432e 100644
--- a/llvm/tools/llvm-remarkutil/RemarkCounter.cpp
+++ b/llvm/tools/llvm-remarkutil/RemarkCounter.cpp
@@ -198,12 +198,8 @@
}
void RemarkCounter::collect(const Remark &Remark) {
- std::optional<std::string> Key = getGroupByKey(Remark);
- if (!Key.has_value())
- return;
- auto Iter = CountedByRemarksMap.insert({*Key, 1});
- if (!Iter.second)
- Iter.first->second += 1;
+ if (std::optional<std::string> Key = getGroupByKey(Remark))
+ ++CountedByRemarksMap[*Key];
}
Error ArgumentCounter::print(StringRef OutputFileName) {