[clang] [LifetimeSafety] Improve destroyed and invalidated diagnostic notes (PR #204900)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 21 13:02:28 PDT 2026
================
@@ -95,7 +95,8 @@ void conditional_operator_lifetimebound(int cond) {
int a, b;
p = identity(cond ? &a // expected-warning {{local variable 'a' does not live long enough}}
: &b); // expected-warning {{local variable 'b' does not live long enough}}
- } // expected-note 2 {{destroyed here}}
+ } // expected-note {{local variable 'a' is destroyed here}}
+ // expected-note at -1 {{local variable 'b' is destroyed here}}
----------------
usx95 wrote:
nit: I am not a big fan of `expected-note at -1`, it disturbs the indent of the text specially if there are other similar warning on the same line.
Consider using trailing `\`:
```
} // expected-note {{local variable 'a' is destroyed here}} \
// expected-note {{local variable 'b' is destroyed here}}
```
https://github.com/llvm/llvm-project/pull/204900
More information about the cfe-commits
mailing list