[PATCH] D99344: [Analyzer] Track RValue expressions

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 25 13:54:33 PDT 2021


NoQ added a comment.

I think this is a good targeted fix for that problem we've discussed, demonstrated by tests.



================
Comment at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:119-124
+/// Attempts to add visitors to track an RValue expression back to its point of
+/// origin. Works similarly to trackExpressionValue, but accepts only RValues.
+void trackRValueExpression(const ExplodedNode *N, const Expr *E,
+                           PathSensitiveBugReport &R,
+                           TrackingKind TKind = TrackingKind::Thorough,
+                           bool EnableNullFPSuppression = true);
----------------
martong wrote:
> steakhal wrote:
> > It is supposed to be called by the `trackExpressionValue()`.
> > Why do we expose this function then?
> I was thinking about that maybe some Checkers could explicitly want to track RValues only. On the other hand, maybe it just complicates the public API. Anyway, I'd like to hear what other people say about this.
I suggest keep it private until there's an actual use case. As of now literally nobody understands how these functions are even supposed to work so it's way too early to give API promises.


================
Comment at: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:1945
+
+  auto IsZero = [&BVF](const Optional<nonloc::ConcreteInt> &CI) {
+    if (!CI)
----------------
`SVal::isZeroConstant()` please ^.^


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99344/new/

https://reviews.llvm.org/D99344



More information about the cfe-commits mailing list