[PATCH] D73151: [analyzer] Fix handle leak false positive when the handle dies too early

Jon Roelofs via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 28 16:28:04 PDT 2020


jroelofs added subscribers: dcoughlin, jroelofs.
jroelofs added inline comments.
Herald added subscribers: ASDenysPetrov, martong.


================
Comment at: clang/test/Analysis/fuchsia_handle.cpp:80
+  zx_status_t status = zx_channel_create(0, &sa, &sb);
+  // expected-note at -1 {{Handle allocated through 2nd parameter}}
+  if (status == 0) { // expected-note {{Assuming 'status' is equal to 0}}
----------------
@xazax.hun, @dcoughlin Is it expected that these diagnostics be non-deterministic? I'm seeing this test case fail sporadically [1] because sometimes the analyzer sees that the 3rd argument leaks, and other times it sees that the 2nd does.

The easy fix here would be to adjust the regex to be flexible against that difference, but I didn't want to cover up an underlying issue by committing that blindly:

```
// expected-note at -1 {{Handle allocated through (2nd|3rd) parameter}}
```

1: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/17048/console


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73151



More information about the cfe-commits mailing list