Skip to content

Commit

Permalink
[llvm-remarkutil] Simplify code with std::map::operator[] (NFC) (#111407
Browse files Browse the repository at this point in the history
)
  • Loading branch information
kazutakahirata authored Oct 8, 2024
1 parent 646aa81 commit 1ad3180
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions llvm/tools/llvm-remarkutil/RemarkCounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,8 @@ void ArgumentCounter::collect(const Remark &Remark) {
}

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) {
Expand Down

0 comments on commit 1ad3180

Please sign in to comment.