<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/152519>152519</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LifetimeSafety] Add support for [[clang::lifetimebound]]
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:temporal-safety
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
usx95
</td>
</tr>
</table>
<pre>
Integrate `[[clang::lifetimebound]]`: This existing Clang annotation is crucial for specifying that the lifetime of a function's output is tied to one of its inputs.
```cpp
std::string_view Trim(std::string_view input [[clang::lifetimebound]]);
std::string_view foo() {
std::string a = "on stack";
std::string_view res = Trim(a);
return res; // warning: returning address of local variable 'a'.
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMkkFv2z4MxT8NfSEayHQcxwcfkn8Q4A_stt4HxpJtbYpkSFTafvvBTroNWw8FCPjgHx_1Hskp2dEb00F9hPpUcJYpxC6n17YuLkG_df97MWNkMQg7tVLH3rEfoTpAdXB2MGKv5hKy11CfltopqA74PNmE5tUmsX7E_5YWZO-DsNjg0SbsY-4tOxxCxDSb3g5vCyoTC8pk8F0bw4CMQ_b90gnUJAxZ5iyLiFijUQIGv3JWElo_Z0kbUIeldupe_TyDOiTR94cnidaP327WvOBztFeg_Yf_VjH8lG9qoTrep34oNYQAtAdqEZqFQ_wLQ0aoTghEwWMS7n8A0V3zH_YuGU1aWx4O-NcbEKORHP1CQHVEBDoDnfGFo7eriQewjtU6mpSW_Fzo2eGNo-WLMwjUMFCzZtmc_oyz0F2l26rlwnRlU2_rplHbspi6mhseSlaqYm1q3nPPPRMb0-6UplYXtiNFtdqrptxWitoN65Kqpm81lU1TGoatMle2buPc7boJcSxsStl0ZU112RaOL8al9WCJ3lci5jqHyO4p8WDkbcmtPhWxWySeLnlMsFXOJkm_RcWKW-_-y2OXX--t9QkPWmPK8xyirNf5mfUXObpuEpnTgqxpj1amfNn04Qp0XuY-Pk9zDN9NL0Dn1VkCOj_M3Tr6GQAA__8N0CC_">