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

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 21:00:18 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-static-analyzer-1

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/115116.diff


1 Files Affected:

- (modified) clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp (+1-3) 


``````````diff
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});

``````````

</details>


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


More information about the cfe-commits mailing list