[clang] [clang][StaticAnalyzer] Implement per checker suppression for CSA (PR #247788)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 2 04:50:05 PST 2026


================
@@ -317,21 +325,28 @@ bool BugSuppression::isSuppressed(const PathDiagnosticLocation &Location,
   // large functions with a lot of bugs it can make a dent in performance.
   // In order to avoid this scenario, we cache traversal results.
   auto InsertionResult = CachedSuppressionLocations.insert(
-      std::make_pair(DeclWithIssue, CachedRanges{}));
-  Ranges &SuppressionRanges = InsertionResult.first->second;
+      std::make_pair(DeclWithIssue, CachedSuppressions{}));
----------------
steakhal wrote:

This is usually cleaner to express as `try_emplace(DeclWithIssue)` - notice no arguments for constructing `second`.
Then either check or assert that it inserted, and assign through the returned iterator that you captured using a structured binding.

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


More information about the cfe-commits mailing list