[llvm] eedff8b - [DebugInfo] Simplify code with std::map::operator[] (NFC) (#115591)

via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 9 08:23:10 PST 2024


Author: Kazu Hirata
Date: 2024-11-09T08:23:02-08:00
New Revision: eedff8b4c0c667c39b034f02c9a40693dff63eda

URL: https://github.com/llvm/llvm-project/commit/eedff8b4c0c667c39b034f02c9a40693dff63eda
DIFF: https://github.com/llvm/llvm-project/commit/eedff8b4c0c667c39b034f02c9a40693dff63eda.diff

LOG: [DebugInfo] Simplify code with std::map::operator[] (NFC) (#115591)

Added: 
    

Modified: 
    llvm/include/llvm/DebugInfo/GSYM/OutputAggregator.h

Removed: 
    


################################################################################
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