[PATCH] D103633: [analyzer] Refactor trackExpressionValue to accept TrackingOptions

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 3 10:40:30 PDT 2021


vsavchenko created this revision.
vsavchenko added reviewers: NoQ, xazax.hun, martong, steakhal, Szelethus, manas, RedDocMD.
Herald added subscribers: ASDenysPetrov, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware.
vsavchenko requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103633

Files:
  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


Index: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -2314,12 +2314,11 @@
 
 bool bugreporter::trackExpressionValue(const ExplodedNode *InputNode,
                                        const Expr *E,
-                                       PathSensitiveBugReport &report,
-                                       bugreporter::TrackingKind TKind,
-                                       bool EnableNullFPSuppression) {
+                                       PathSensitiveBugReport &Report,
+                                       TrackingOptions Opts) {
 
-  return Tracker::create(report)
-      ->track(E, InputNode, {TKind, EnableNullFPSuppression})
+  return Tracker::create(Report)
+      ->track(E, InputNode, Opts)
       .FoundSomethingToTrack;
 }
 
@@ -2376,9 +2375,9 @@
   // 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());
Index: clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
@@ -148,7 +148,7 @@
           *BT, "Index is out of bounds", N);
       R->addRange(IdxExpr->getSourceRange());
       bugreporter::trackExpressionValue(
-          N, IdxExpr, *R, bugreporter::TrackingKind::Thorough, false);
+          N, IdxExpr, *R, {bugreporter::TrackingKind::Thorough, false});
       C.emitReport(std::move(R));
       return;
     }
Index: clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
@@ -284,8 +284,8 @@
       N);
 
   R->addRange(RS->getSourceRange());
-  bugreporter::trackExpressionValue(N, RS->getRetValue(), *R,
-                                    bugreporter::TrackingKind::Thorough, false);
+  bugreporter::trackExpressionValue(
+      N, RS->getRetValue(), *R, {bugreporter::TrackingKind::Thorough, false});
   C.emitReport(std::move(R));
 }
 
Index: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
===================================================================
--- clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
+++ clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
@@ -348,9 +348,7 @@
 ///         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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103633.349605.patch
Type: text/x-patch
Size: 3759 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210603/b83bd945/attachment-0001.bin>


More information about the cfe-commits mailing list