[clang] [LifetimeSafety] Add multi-block support to buildOriginFlowChain (PR #204592)

Yuan Suo via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 20 01:48:25 PDT 2026


================
@@ -1428,7 +1440,8 @@ void range_based_for_use_after_scope() {
   View v;
   {
     MyObjStorage s;
-    for (const MyObj &o : s) { // expected-warning {{local variable 's' does not live long enough}}
+    for (const MyObj &o : s) { // expected-warning {{local variable 's' does not live long enough}} \
+                               // expected-note {{local variable '__range2' aliases the storage of local variable 's'}}
----------------
suoyuan666 wrote:

How about checking `Decl->isImplicit()`? This check has already been added in `shouldShowInAliasChain` in the latest change.

https://github.com/llvm/llvm-project/pull/204592


More information about the cfe-commits mailing list