[clang] [analyzer] Conversion to CheckerFamily: MallocChecker (PR #147080)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 7 08:01:33 PDT 2025


================
@@ -402,16 +449,19 @@ class MallocChecker
                   const char *NL, const char *Sep) const override;
 
 private:
-  mutable std::unique_ptr<BugType> BT_DoubleFree[CK_NumCheckKinds];
-  mutable std::unique_ptr<BugType> BT_DoubleDelete;
-  mutable std::unique_ptr<BugType> BT_Leak[CK_NumCheckKinds];
-  mutable std::unique_ptr<BugType> BT_UseFree[CK_NumCheckKinds];
-  mutable std::unique_ptr<BugType> BT_BadFree[CK_NumCheckKinds];
-  mutable std::unique_ptr<BugType> BT_FreeAlloca[CK_NumCheckKinds];
-  mutable std::unique_ptr<BugType> BT_MismatchedDealloc;
-  mutable std::unique_ptr<BugType> BT_OffsetFree[CK_NumCheckKinds];
-  mutable std::unique_ptr<BugType> BT_UseZerroAllocated[CK_NumCheckKinds];
-  mutable std::unique_ptr<BugType> BT_TaintedAlloc;
+  /// Helper method to handle the cases where there is no associated frontend
+  /// (just exit early) or the associated frontend is disabled (sink the
+  /// execution path and and then exit early). Intended to be called as
+  ///   if (handleNullOrDisabled(Frontend, C))
+  ///     return;
+  static bool handleNullOrDisabled(const CheckerFrontend *F,
----------------
NagyDonat wrote:

Note to self: As we discussed with @gamesh411, get rid of this helper method, inline its definition for better readability.

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


More information about the cfe-commits mailing list