[clang] [analyzer] Splitting TaintPropagation checker into reporting and mode… (PR #98157)
Donát Nagy via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 10 03:17:51 PDT 2024
================
@@ -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:
We only use that `unique_ptr` has a null / empty state in addition to representing the "real" `BugType` values. However, `std::optional` would be completely sufficient for this goal (here and AFAIK in every checker that uses `unique_ptr`s to juggle multiple `BugType`s).
If we really want, in _this_ checker we could use a "bare" `BugType` data member if we leave it uninitialized in the constructor of the checker class (or initialize it with dummy values) and then unconditionally overwrite it with the "real" `BugType` in this `register...` function. (Other checkers have lazy initialization patterns that check the nullness of the `BugType`.)
https://github.com/llvm/llvm-project/pull/98157
More information about the cfe-commits
mailing list