[PATCH] D134941: [analyzer][NFC] Add tests for D132236

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 04:51:41 PDT 2022


martong added a comment.

Thank you! Increasing coverage in tests is always great.



================
Comment at: clang/test/Analysis/NewDeleteLeaks.cpp:196
+
+namespace symbol_reaper_lifetime {
+struct Nested {
----------------
Could you please add some explanation for the test case? Thinking of the related patch, something like this could be a good explanation:
```
Check that memory leak is reported against a symbol if the last place it's mentioned is a base region of a lazy compound value, as the program cannot possibly free that memory. 
```
And below, we should mention that `p` is that symbol and `p->data` is the lazy compound value.


================
Comment at: clang/test/Analysis/symbol-reaper-lambda.cpp:8
+
+int strange(Dummy param) {
+  Dummy local_pre_lambda;
----------------
Maybe it is just me, but this test case is a bit hard to follow. I guess it is a result of creduce. But still, could you please elaborate the following:


  # What is the lazy compound value? (My weak guess is `param`)
  # What is the base region?
  # Which symbol is being reaped and where?




================
Comment at: clang/test/Analysis/symbol-reaper-lambda.cpp:14
+    escape(param, local_pre_lambda);
+    return ref_captured; // no-warning: The value is not garbage.
+  };
----------------
Did D132236 produce an FP warning for this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134941



More information about the cfe-commits mailing list