[clang] Adding optin.taint.TaintedDiv checker (PR #106389)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 29 03:15:22 PDT 2024


================
@@ -25,16 +25,20 @@ using namespace ento;
 using namespace taint;
 
 namespace {
-class DivZeroChecker : public Checker< check::PreStmt<BinaryOperator> > {
-  const BugType BT{this, "Division by zero"};
-  const BugType TaintBT{this, "Division by zero", categories::TaintedData};
+class DivZeroChecker : public Checker<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 multiple user facing checker
+  enum CheckKind { CK_DivZeroChecker, CK_TaintedDivChecker, CK_NumCheckKinds };
----------------
NagyDonat wrote:

Please use `DivideZero` instead of `DivZero` in the name of the `CheckKind` to be consistent with the name of the `core.DivideZero` checker. (The name of source file and the checker class may stay `DivZero`, because they are no longer in 1:1 correspondence with the checker. It's unfortunate that we have these inconsistencies, they are really annoying during the development.)

Also I'd omit the `Checker` suffix from these enum constants -- it doesn't provide any added information.

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


More information about the cfe-commits mailing list