[clang] [LifetimeSafety] Infer [[clang::lifetimebound]] annotation (PR #171081)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 8 01:23:45 PST 2025
================
@@ -552,6 +552,20 @@ const int& get_ref_to_local() {
// expected-note at -1 {{returned here}}
}
+View inference_callee_return_identity(View a) {
----------------
usx95 wrote:
```cpp
namespace inference_in_order_with_redecls {
View inference_callee_return_identity(View a);
View inference_callee_return_identity(View a) {
return a;
}
View inference_caller_forwards_callee(View a);
View inference_caller_forwards_callee(View a) {
return inference_callee_return_identity(a);
}
View inference_top_level_return_stack_view() {
MyObj local_stack;
return inference_caller_forwards_callee(local_stack); // expected-warning {{address of stack memory is returned later}}
// expected-note at -1 {{returned here}}
}
} // namespace inference_in_order_with_redecls
```
https://github.com/llvm/llvm-project/pull/171081
More information about the cfe-commits
mailing list