<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/152501>152501</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [LifetimeSafety] Add basic a use-after-return diagnostic
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          usx95
      </td>
    </tr>
</table>

<pre>
    Detecting when a function returns a reference to its own stack memory.

```cpp
int* foo() {
  int a = 1;
  int* res = &a;
  return res;   // warning: returning address of local variable 'a'.
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxMkc2uozAMhZ_GbKxWwRAoCxZcVV3Nbp7ABEMzE5IqCbdz334E7fxIliL5OMnnczglu3iRHvQH6GvBW76H2G_pV6eLMUxf_VWymGz9gs-7eGScN2-yDR6j5C36hIxRZonijWAOaHPC8PSYMpufuMoa4tcZ1LBXo15lHg9Qg_UZaMA5BKALUIfQfoAaEK3PyAjVFUuo_rb22Sjp6AM1_Ed6cewSVB-ICHQDuuGTo7d-gWp4T-w78DRFSQnDjC4YdvjJ0fLoBIFaBmoP0vb6P2wx9dXUVR0X0petrnVbN3VT3HvVdKpj1bUyUd1chLua6laTKi9dqZuysD0p0uqi2rLSqtZnUzWlLkstU12rC49QK1nZurNzn-s5xKWwKW3Sl5q0KgvHo7h0ZEPk5YmHCkR7VLHfL53GbUlQK2dTTv-eyTa7I9RvdpZsV_nOs-Qv0FccpglHTtYg45bkxHOWeHqbOFlefEjZmmKLrr_n_EhQDS9LF5vv23g2YQW67V-9j9Mjhh9iMtDtAExAt_cGnz39DgAA__87nLtE">