[clang] [LifetimeSafety] Add multi-block support to buildOriginFlowChain (PR #204592)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 25 00:29:50 PDT 2026
================
@@ -1975,6 +1975,50 @@ TEST_F(LifetimeAnalysisTest, LambdaInitCaptureViewByValue) {
// Tests for buildOriginFlowChain
// ========================================================================= //
+TEST_F(LifetimeAnalysisTest, BuildOriginFlowChain) {
+ SetupTest(R"(
+ void target(bool c1, bool c2) {
+ int *s;
+ int *a, *b, *c;
+
+ {
+ int tgta, tgtb, tgtc;
+ a = &tgta;
+ b = &tgtb;
+ c = &tgtc;
+ }
+
+ if (c1) {
+ s = c2 ? a : b;
+ } else {
+ s = c;
+ }
+
+ POINT(after_nested_merge);
+ (void)*s;
+ }
----------------
usx95 wrote:
Just to make sure, can you reset `s` after the point of use and make sure the same tests still pass.
```cpp
POINT(after_nested_merge);
(void)*s;
int reset;
s = &reset;
```
https://github.com/llvm/llvm-project/pull/204592
More information about the cfe-commits
mailing list