[clang] [analyzer] Conversion to CheckerFamily: StackAddrEscapeChecker (PR #151136)

Donát Nagy via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 30 04:43:00 PDT 2025


================
@@ -28,23 +28,20 @@ using namespace ento;
 
 namespace {
 class StackAddrEscapeChecker
-    : public Checker<check::PreCall, check::PreStmt<ReturnStmt>,
-                     check::EndFunction> {
+    : public CheckerFamily<check::PreCall, check::PreStmt<ReturnStmt>,
+                           check::EndFunction> {
   mutable IdentifierInfo *dispatch_semaphore_tII = nullptr;
-  mutable std::unique_ptr<BugType> BT_stackleak;
-  mutable std::unique_ptr<BugType> BT_returnstack;
-  mutable std::unique_ptr<BugType> BT_capturedstackasync;
-  mutable std::unique_ptr<BugType> BT_capturedstackret;
 
 public:
-  enum CheckKind {
-    CK_StackAddrEscapeChecker,
-    CK_StackAddrAsyncEscapeChecker,
-    CK_NumCheckKinds
-  };
+  StringRef getDebugTag() const override { return "StackAddrEscapeChecker"; }
 
-  bool ChecksEnabled[CK_NumCheckKinds] = {false};
-  CheckerNameRef CheckNames[CK_NumCheckKinds];
+  CheckerFrontend StackAddrEscape, StackAddrAsyncEscape;
----------------
NagyDonat wrote:

To me it is slightly more natural to put these on a single line (just because they fit nicely), but I split them if you prefer that style.

By the way, as far as I see this "separate declarations" style is not mentioned in the [LLVM Coding Standards](https://llvm.org/docs/CodingStandards.html). Perhaps it would be useful to mention it there – or open discussion about including it...

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


More information about the cfe-commits mailing list