[PATCH] D155547: [analyzer] Model lifetime of a variable declared in for condition in CFG correctly

Tomasz KamiƄski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 07:26:13 PDT 2023


tomasz-kaminski-sonarsource added inline comments.


================
Comment at: clang/test/Analysis/auto-obj-dtors-cfg-output.cpp:1231
   A a;
-  for (A b; A c = b; ) {
+  for (A b; A c = b; ++c.x) {
     A d;
----------------
xazax.hun wrote:
> Would there be any value in also keeping a couple of the original test cases? (When we have empty increment blocks). 
> 
> How about a test case where the increment operation generates multiple basic blocks (e.g., have a ternary)?
> Would there be any value in also keeping a couple of the original test cases? (When we have empty increment blocks). 
I have removed the increment op from `test_for_jumps`, to cover both situation without extending the number of test.

> How about a test case where the increment operation generates multiple basic blocks (e.g., have a ternary)?

Added, check `test_for_inc_conditional`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155547



More information about the cfe-commits mailing list