[PATCH] D153273: [analyzer] Rework support for CFGScopeBegin, CFGScopeEnd, CFGLifetime elements

Tomasz KamiƄski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 17 07:19:51 PDT 2023


tomasz-kaminski-sonarsource marked 2 inline comments as done.
tomasz-kaminski-sonarsource added inline comments.


================
Comment at: clang/test/Analysis/nonreturn-destructors-cfg-output.cpp:99
+//
+// CHECK:       [B2 (NORETURN)]
+// CHECK-NEXT:    1: [B3.3].~A() (Implicit destructor)
----------------
xazax.hun wrote:
> B3 and B5 look almost identical. Do we need both? If not, would there be a way to deduplicate?
`B2` is created when we visit the statement in reverse order. This includes all statement until we reach `goto`. So if the code would look like:
```
{
  A a;
  goto label;
  int b;
    foo();
}
label:
   foo();
```
Then `B2` will include two calls to `foo` and lifetime of `int b`. The `B5` only includes destructor of `a` that happens after `goto`. 

So the similarly here only happens by accident, or in other words is by product of the code. In this case any deduplication mechanism for blocks will need to be content based, and I haven't seen anything like that happening in the code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153273



More information about the cfe-commits mailing list