[clang] [NFC][analyzer] Rename `CheckerBase::getCheckerName` to `getName` (PR #130953)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 12 11:05:23 PDT 2025


================
@@ -41,19 +41,19 @@ class BugType {
         Checker(nullptr), SuppressOnSink(SuppressOnSink) {}
   BugType(const CheckerBase *Checker, StringRef Desc,
           StringRef Cat = categories::LogicError, bool SuppressOnSink = false)
-      : CheckerName(Checker->getCheckerName()), Description(Desc),
-        Category(Cat), Checker(Checker), SuppressOnSink(SuppressOnSink) {}
+      : CheckerName(), Description(Desc), Category(Cat), Checker(Checker),
----------------
NagyDonat wrote:

It calls the default constructor of `CheckerNameRef CheckerName` which initializes this data member to an empty string.

In fact the two data members `CheckerName` and `Checker` should have been alternatives within a single `variant` (and not separate data members), because one of them is always an unused empty value. (The first constructor fills `CheckerName`, the second one fills `Checker`.)

This `variant`ization of these two data members does happen in follow-up PR https://github.com/llvm/llvm-project/pull/130985 (which introduces my multipart checker framework).

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


More information about the cfe-commits mailing list