[clang] [analyzer][NFC] Introduce framework for checker families (PR #139256)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Tue May 13 09:48:21 PDT 2025
=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>,
=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>,
=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>,
=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>,
=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>,
=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/139256 at github.com>
================
@@ -25,25 +25,23 @@ using namespace ento;
using namespace taint;
namespace {
-class DivZeroChecker : public Checker<check::PreStmt<BinaryOperator>> {
+class DivZeroChecker : public CheckerFamily<check::PreStmt<BinaryOperator>> {
void reportBug(StringRef Msg, ProgramStateRef StateZero,
CheckerContext &C) const;
void reportTaintBug(StringRef Msg, ProgramStateRef StateZero,
CheckerContext &C,
llvm::ArrayRef<SymbolRef> TaintedSyms) const;
public:
- /// This checker class implements several user facing checkers
- enum : CheckerPartIdx {
- DivideZeroChecker,
- TaintedDivChecker,
- NumCheckerParts
- };
- BugType BugTypes[NumCheckerParts] = {
- {this, DivideZeroChecker, "Division by zero"},
- {this, TaintedDivChecker, "Division by zero", categories::TaintedData}};
+ /// This checker family implements two user-facing checker parts.
+ CheckerFrontendWithBugType DivideZeroChecker{"Division by zero"},
+ TaintedDivChecker{"Division by zero", categories::TaintedData};
void checkPreStmt(const BinaryOperator *B, CheckerContext &C) const;
+
+ /// Identifies this checker family for debugging purposes. For backwards
+ /// compatibility, this is the name of the older sub-checker.
+ StringRef getTagDescription() const override { return "core.DivideZero"; }
----------------
steakhal wrote:
If we are here, this API name always bothered me. If this is used for debugging, why not call this `debugName`?
https://github.com/llvm/llvm-project/pull/139256
More information about the cfe-commits
mailing list