[analyzer] Model lifetime of a variable declared in for condition in CFG correctly
Per [stmt.for] p1 (https://eel.is/c++draft/stmt.for#1) the following `for` and `while` statements are equivalent ``` for (; A c = b; b.c) { A d; } while (A c = b) { A d; b.c; } ``` As a consequence, the variable declared for the condition expression should be destroyed after the increment expression. This fixed the handling of the object lifetime `continue`, and now destructors, scope and lifetime elements are present for continue path in following code: ``` for (; A c = b; b.c) { if (cond) continue; A d; } ``` Reviewed By: xazax.hun Differential Revision: https://reviews.llvm.org/D155547
Loading
Please sign in to comment