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

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


================
@@ -116,6 +116,19 @@ class CheckerNameRef {
   operator StringRef() const { return Name; }
 };
 
+/// A single checker class (and its singleton instance) can act as the
+/// implementation of several (user-facing or modeling) checker parts that
+/// have shared state and logic, but have their own names and can be enabled or
+/// disabled separately.
+/// Each checker class that implement multiple parts introduces its own enum
+/// type to assign small numerical indices (0, 1, 2 ...) to their parts. The
+/// type alias 'CheckerPartIdx' is conceptually the union of these enum types.
+using CheckerPartIdx = unsigned;
+
+/// If a checker doesn't have multiple parts, then its single part is
+/// represented by this index.
+constexpr CheckerPartIdx DefaultPart = 0;
----------------
NagyDonat wrote:

Yes, I wasn't familiar enough with the rules for "`constexpr`" (now I looked it up: it does imply `inline` for functions and `static` data members, but doesn't imply it for other variables).

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


More information about the cfe-commits mailing list