[PATCH] D116597: [analyzer] Don't track function calls as control dependencies

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 7 07:06:58 PST 2022


steakhal added a comment.

Looks great!
Thanks for your hard work on this topic @Szelethus.



================
Comment at: clang/lib/Analysis/CFG.cpp:5908-5909
 
+void CFG::dump(bool ShowColors) const { dump(LangOptions{}, ShowColors); }
+
 /// print - A simple pretty printer of a CFG that outputs to an ostream.
----------------
How are these `dump()` changes related?


================
Comment at: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:1968
+static const Expr *peelOffOuterExpr(const Expr *Ex, const ExplodedNode *N) {
+
   Ex = Ex->IgnoreParenCasts();
----------------
extra blank line


================
Comment at: clang/test/Analysis/track-control-dependency-conditions.cpp:1006
+  x = nullptr;              // expected-note {{Null pointer value stored to 'x'}}
+  if (auto e = couldFail()) // expected-note {{Taking true branch}}
+    *x = 5;                 // expected-warning {{Dereference of null pointer (loaded from variable 'x') [core.NullDereference]}}
----------------
Please also have a `c++17` init if statement.


================
Comment at: clang/test/Analysis/track-control-dependency-conditions.cpp:1036
+  x = nullptr;        // expected-note {{Null pointer value stored to 'x'}}
+  if (!alwaysFalse()) // expected-note {{Taking true branch}}
+    *x = 5;           // expected-warning {{Dereference of null pointer (loaded from variable 'x') [core.NullDereference]}}
----------------
What if this expression is enclosed by a logical operator such as `&&`?


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

https://reviews.llvm.org/D116597



More information about the cfe-commits mailing list