================ @@ -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"; } ---------------- NagyDonat wrote:
When I wrote this commit I preserved the tag description `"core.DivideZero"` because it was tested by `ftime-trace.cpp`. However, now I'm convinced that the old behavior where the tag description was the name of one sub-checker in the family (the first one) is inelegant, because the tag description should clearly identify the whole family. To ensure this, I created commit https://github.com/llvm/llvm-project/pull/139256/commits/8459b2f19139a6444d7a219c611bc085bced8e18 which changes the tag description to `DivZeroChecker` (the class name), which seems to be a natural choice. (Note that in `VirtualCallChecker` I already used the class name as a tag description when I first uploaded this PR.) https://github.com/llvm/llvm-project/pull/139256 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits