================
@@ -1122,10 +1131,20 @@ void 
GenericTaintChecker::taintUnsafeSocketProtocol(const CallEvent &Call,
 }
 
 /// Checker registration
-void ento::registerGenericTaintChecker(CheckerManager &Mgr) {
+void ento::registerTaintPropagationChecker(CheckerManager &Mgr) {
   Mgr.registerChecker<GenericTaintChecker>();
 }
 
+bool ento::shouldRegisterTaintPropagationChecker(const CheckerManager &mgr) {
+  return true;
+}
+
+void ento::registerGenericTaintChecker(CheckerManager &Mgr) {
+  GenericTaintChecker *checker = Mgr.getChecker<GenericTaintChecker>();
+  checker->isTaintReporterCheckerEnabled = true;
+  checker->reporterCheckerName = Mgr.getCurrentCheckerName();
----------------
NagyDonat wrote:

Because this way we can access the checker name specified in `Checkers.td` via 
the function `Mgr.getCurrentCheckerName();`.

When the checker class corresponds to just one checker defined in `Checkers.td` 
we can use the alternative constructor of `BugType` that takes the checker 
object (`this`) as a first argument and then queries the name from the checker 
object (which can save a _single_ name automatically).

When a single class implements multiple checkers, we need to explicitly pass 
the right name to the `BugType` constructor, and so we need to either (1) 
postpone the construction of the `BugType` to a point after the registration or 
(2) duplicate the checker name between `Checkers.td` and the source file.

AFAIK we always choose option (1), but I didn't check this systematically.

https://github.com/llvm/llvm-project/pull/98157
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to