[clang] [NFC][analyzer] Framework for multipart checkers (PR #130985)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 14 09:13:09 PDT 2025


================
@@ -190,23 +203,38 @@ class CheckerManager {
   // Checker registration.
   //===--------------------------------------------------------------------===//
 
-  /// Used to register checkers.
-  /// All arguments are automatically passed through to the checker
-  /// constructor.
+  /// Construct the singleton instance of a checker, register it for the
+  /// supported callbacks and record its name with `registerCheckerPart()`.
+  /// Arguments passed to this function are forwarded to the constructor of the
+  /// checker.
+  ///
+  /// If `CHECKER` has multiple parts, then the constructor call and the
+  /// callback registration only happen within the first `registerChecker()`
+  /// call; while the subsequent calls only enable additional parts of the
+  /// existing checker object (while registering their names).
   ///
   /// \returns a pointer to the checker object.
-  template <typename CHECKER, typename... AT>
-  CHECKER *registerChecker(AT &&... Args) {
+  template <typename CHECKER, CheckerPartIdx Idx = DefaultPart, typename... AT>
+  CHECKER *registerChecker(AT &&...Args) {
+    // This assert could be removed but then need to make sure that calls that
+    // register different parts of the same checker pass the same arguments.
----------------
NagyDonat wrote:

```suggestion
    // This assert could be removed but then we need to make sure that calls
    // registering different parts of the same checker pass the same arguments.
```

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


More information about the cfe-commits mailing list