[clang] 57006d2 - [analyzer] Refactor trackExpressionValue to accept TrackingOptions
Valeriy Savchenko via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 11 02:52:03 PDT 2021
Author: Valeriy Savchenko
Date: 2021-06-11T12:49:04+03:00
New Revision: 57006d2f6d96d8a6836ae901218ed615071b3b8e
URL: https://github.com/llvm/llvm-project/commit/57006d2f6d96d8a6836ae901218ed615071b3b8e
DIFF: https://github.com/llvm/llvm-project/commit/57006d2f6d96d8a6836ae901218ed615071b3b8e.diff
LOG: [analyzer] Refactor trackExpressionValue to accept TrackingOptions
Differential Revision: https://reviews.llvm.org/D103633
Added:
Modified:
clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
index ba652be33fb5..17a8e7859a54 100644
--- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
+++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
@@ -353,9 +353,7 @@ class TrackingBugReporterVisitor : public BugReporterVisitor {
/// statement. Note that returning \c true does not actually imply
/// that any visitors were added.
bool trackExpressionValue(const ExplodedNode *N, const Expr *E,
- PathSensitiveBugReport &R,
- TrackingKind TKind = TrackingKind::Thorough,
- bool EnableNullFPSuppression = true);
+ PathSensitiveBugReport &R, TrackingOptions Opts = {});
/// Track how the value got stored into the given region and where it came
/// from.
diff --git a/clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
index 837213875a60..b72d72580c28 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
@@ -284,8 +284,9 @@ void MIGChecker::checkReturnAux(const ReturnStmt *RS, CheckerContext &C) const {
N);
R->addRange(RS->getSourceRange());
- bugreporter::trackExpressionValue(N, RS->getRetValue(), *R,
- bugreporter::TrackingKind::Thorough, false);
+ bugreporter::trackExpressionValue(
+ N, RS->getRetValue(), *R,
+ {bugreporter::TrackingKind::Thorough, /*EnableNullFPSuppression=*/false});
C.emitReport(std::move(R));
}
diff --git a/clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
index 8c2008a7ceb4..13985af76b00 100644
--- a/clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
@@ -147,8 +147,9 @@ void ObjCContainersChecker::checkPreStmt(const CallExpr *CE,
auto R = std::make_unique<PathSensitiveBugReport>(
*BT, "Index is out of bounds", N);
R->addRange(IdxExpr->getSourceRange());
- bugreporter::trackExpressionValue(
- N, IdxExpr, *R, bugreporter::TrackingKind::Thorough, false);
+ bugreporter::trackExpressionValue(N, IdxExpr, *R,
+ {bugreporter::TrackingKind::Thorough,
+ /*EnableNullFPSuppression=*/false});
C.emitReport(std::move(R));
return;
}
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index ede76154ac7a..c51b7db2b2f3 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -2314,11 +2314,11 @@ PathDiagnosticPieceRef Tracker::handle(StoreInfo SI, TrackingOptions Opts) {
bool bugreporter::trackExpressionValue(const ExplodedNode *InputNode,
const Expr *E,
- PathSensitiveBugReport &report,
- bugreporter::TrackingKind TKind,
- bool EnableNullFPSuppression) {
- return Tracker::create(report)
- ->track(E, InputNode, {TKind, EnableNullFPSuppression})
+
+ PathSensitiveBugReport &Report,
+ TrackingOptions Opts) {
+ return Tracker::create(Report)
+ ->track(E, InputNode, Opts)
.FoundSomethingToTrack;
}
@@ -2375,9 +2375,9 @@ NilReceiverBRVisitor::VisitNode(const ExplodedNode *N, BugReporterContext &BRC,
// The receiver was nil, and hence the method was skipped.
// Register a BugReporterVisitor to issue a message telling us how
// the receiver was null.
- bugreporter::trackExpressionValue(
- N, Receiver, BR, bugreporter::TrackingKind::Thorough,
- /*EnableNullFPSuppression*/ false);
+ bugreporter::trackExpressionValue(N, Receiver, BR,
+ {bugreporter::TrackingKind::Thorough,
+ /*EnableNullFPSuppression*/ false});
// Issue a message saying that the method was skipped.
PathDiagnosticLocation L(Receiver, BRC.getSourceManager(),
N->getLocationContext());
More information about the cfe-commits
mailing list