Skip to content

Commit 1ad3180

Browse files
[llvm-remarkutil] Simplify code with std::map::operator[] (NFC) (#111407)
1 parent 646aa81 commit 1ad3180

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

llvm/tools/llvm-remarkutil/RemarkCounter.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,8 @@ void ArgumentCounter::collect(const Remark &Remark) {
198198
}
199199

200200
void RemarkCounter::collect(const Remark &Remark) {
201-
std::optional<std::string> Key = getGroupByKey(Remark);
202-
if (!Key.has_value())
203-
return;
204-
auto Iter = CountedByRemarksMap.insert({*Key, 1});
205-
if (!Iter.second)
206-
Iter.first->second += 1;
201+
if (std::optional<std::string> Key = getGroupByKey(Remark))
202+
++CountedByRemarksMap[*Key];
207203
}
208204

209205
Error ArgumentCounter::print(StringRef OutputFileName) {

0 commit comments

Comments
 (0)