Issue 182935
Summary [LifetimeSafety] Verify lifetimebound annotation
Labels clang:temporal-safety
Assignees
Reporter usx95
    ```cpp
std::string_view identity(const std::string& in) { return in; }

std::string_view max(const std::string& a [[clang::lifetimebound]], 
 const std::string& b [[clang::lifetimebound]]) {
  return a > b ? identity(a): identity(b);
}
```

For verification of `lifetimebound`, we need to verify that annotated parameter escapes via `return`.

For example, in the above snippet, we must get a warning that `lifetimebound` on `a` and `b` cannot be verified. In order for the analysis to deduce a escape via return, `identity` must be annotated with `lifetimebound`.  

cc: @AbhinavPradeep 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to