[PATCH] D107078: [analyzer] Catch leaking stack addresses via stack variables

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 29 08:32:45 PDT 2021


martong added a comment.

This is awesome!



================
Comment at: clang/test/Analysis/copy-elision.cpp:9-10
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -std=c++17 \
+// RUN:    -analyzer-config elide-constructors=false -DNO_ELIDE_FLAG              \
+// RUN:    -analyzer-config eagerly-assume=false -verify %s
 
----------------
Should we use `-verify=no-elide` here as well? Since we set the `DNO_ELIDE_FLAG`?


================
Comment at: clang/test/Analysis/copy-elision.cpp:195
+  // expected-warning at -1 {{Address of stack memory associated with local \
+variable 'c' is still referred to by the stack variable 'v' upon returning \
+to the caller}}
----------------
It would be useful to have a test with `// RUN:   -analyzer-output=text \` to make sure that we have a note placed for `v` at `consume(make3(v))`. Do we have such a note? This could be done perhaps in another test file.


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

https://reviews.llvm.org/D107078



More information about the cfe-commits mailing list