[llvm] [DebugInfo] Simplify code with std::map::operator[] (NFC) (PR #115591)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 8 23:31:53 PST 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/115591
None
>From 69f504c21c3b9bc48dfa1400e4de7c58ab22590e Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 8 Nov 2024 07:44:32 -0800
Subject: [PATCH] [DebugInfo] Simplify code with std::map::operator[] (NFC)
---
llvm/include/llvm/DebugInfo/GSYM/OutputAggregator.h | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/llvm/include/llvm/DebugInfo/GSYM/OutputAggregator.h b/llvm/include/llvm/DebugInfo/GSYM/OutputAggregator.h
index 35ef0a8bc89085..ab20634b0b9384 100644
--- a/llvm/include/llvm/DebugInfo/GSYM/OutputAggregator.h
+++ b/llvm/include/llvm/DebugInfo/GSYM/OutputAggregator.h
@@ -60,11 +60,8 @@ class OutputAggregator {
// then merge it in here. Note that this is *not* thread safe. It is up to
// the caller to ensure that this is only called from one thread at a time.
void Merge(const OutputAggregator &other) {
- for (auto &&[name, count] : other.Aggregation) {
- auto [it, inserted] = Aggregation.emplace(name, count);
- if (!inserted)
- it->second += count;
- }
+ for (auto &&[name, count] : other.Aggregation)
+ Aggregation[name] += count;
}
};
More information about the llvm-commits
mailing list