[clang] [StaticAnalyzer] Simplify code with DenseMap::operator[] (NFC) (PR #115116)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 20:59:47 PST 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/115116

None

>From 6e60305ce06368ca6f0a85407f7945d83f5bacf0 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 5 Nov 2024 09:59:27 -0800
Subject: [PATCH] [StaticAnalyzer] Simplify code with DenseMap::operator[]
 (NFC)

---
 clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
index f524c4c067c8c3..e1ad5911ea0b70 100644
--- a/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
@@ -131,9 +131,7 @@ class NonLocalizedStringBRVisitor final : public BugReporterVisitor {
 
 #define NEW_RECEIVER(receiver)                                                 \
   llvm::DenseMap<Selector, uint8_t> &receiver##M =                             \
-      UIMethods.insert({&Ctx.Idents.get(#receiver),                            \
-                        llvm::DenseMap<Selector, uint8_t>()})                  \
-          .first->second;
+      UIMethods[&Ctx.Idents.get(#receiver)];
 #define ADD_NULLARY_METHOD(receiver, method, argument)                         \
   receiver##M.insert(                                                          \
       {Ctx.Selectors.getNullarySelector(&Ctx.Idents.get(#method)), argument});



More information about the cfe-commits mailing list