[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:21 PDT 2024


================
@@ -48,8 +52,14 @@ static const Expr *getDenomExpr(const ExplodedNode *N) {
 
 void DivZeroChecker::reportBug(StringRef Msg, ProgramStateRef StateZero,
                                CheckerContext &C) const {
+  if (!ChecksEnabled[CK_DivZeroChecker])
+    return;
+  if (!BugTypes[CK_DivZeroChecker])
+    BugTypes[CK_DivZeroChecker].reset(
+        new BugType(CheckNames[CK_DivZeroChecker], "Division by zero"));
----------------
NagyDonat wrote:

It's a pity that we need this lazy dynamic initialization :face_with_diagonal_mouth:. We should really introduce a clear framework to avoid this. 

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


More information about the cfe-commits mailing list