[PATCH] D62978: [analyzer] ReturnVisitor: Handle unknown ReturnStmts better

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 10 18:41:20 PDT 2019


NoQ added inline comments.


================
Comment at: clang/test/Analysis/diagnostics/find_last_store.c:9
 void no_find_last_store() {
-  c *e = d(); // expected-note{{Calling 'd'}}
-              // expected-note at -1{{Returning from 'd'}}
-              // expected-note at -2{{'e' initialized here}}
+  c *e = d(); // expected-note{{'e' initialized here}}
 
----------------
This remaining note is also unnecessary. You can safely stop tracking the value at `e || ...`. In particular, `ReturnVisitor` is not at fault.

That said, when we renamed `trackNullOrUndefValue` to `trackExpressionValue`, we kinda assumed that it's not really important whether the value is null/undef or not - the function simply tracks the value. This change would break this invariant, causing null values to be handled in a special manner. I recommend adding another flag argument (similar to `EnableNullFPSuppression`) that would allow the caller to tell whether it's interested in the null or in the "whole" value (defaulting to the latter).


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

https://reviews.llvm.org/D62978





More information about the cfe-commits mailing list