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

    <tr>
        <th>Summary</th>
        <td>
            bugprone-dangling-handle does not work
        </td>
    </tr>

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

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

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

<pre>
    Given the following snippet of code, copied from the example in https://clang.llvm.org/extra/clang-tidy/checks/bugprone-dangling-handle.html

```C++
#include <string>
#include <string_view>
#include <vector>

using namespace std;

int main() {
  string_view View = string();  // View will dangle.
  string A;
  View = A + "A";  // still dangle.

  vector<string_view> V;
  V.push_back(string());  // V[0] is dangling.
  V.resize(3, string());  // V[1] and V[2] will also dangle.
}

std::string_view f() {
  // All these return values will dangle.
  return string();
  string S;
  return S;
  char Array[10]{};
  return Array;
}
```

Running this command does not catch any of the sample errors:
```
llvm/llvm-project/build/bin/clang-tidy --extra-arg="--std=c++17" --checks="bugprone-dangling-handle,-clang-diagnostic-dangling-gsl,-clang-diagnostic-return-stack-address" bugprone_dangling_handle.cpp
```

Expected results: The sample errors should trigger bugprone-dangling-handle checks.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyFVE1z2yAQ_TXyZUcaGclfBx2cOO297eTqQYAlGgQaQHbcX99Fkm3FidsZfcLyln37HqXh5-K7PAoNvhZwMEqZk9QVOC3bVngwB2CGi4g847uVgsPBmqYPFu-0aZUAqaH2vnVRto3IN7yYorpKlDo2ibEVDoh3b-llIvaSn8NPLdibw4-yq1prtIg5zipMHtdUcyWS2jcqSndRuh2fy3S4niPyFK5hlGRSM9VxAVH27LxFhCh7eTy5P0pxehBxFMwbe5vsn50LjGjaCNdSJsB5HmVP0wipPTRU6oisI7KBaDXOAkxSwmt4RNluHByCEQlg4G0IOEmloKdCJB9RYHtNCzewLa5-wptgKWSK5vwnpMviS5l3jMDrNEHSdq7el5S94U4_bPlu19HiKY0WO5AOLi1MbihWOPkHBbTOgoj-gzMPONj9_oeEn54Oqpy5q2S1m5bUtwTp2U75Pnxux5hqi5goYSfACt9ZDUeqOuG-5H6MuOvZXWd-TobGBdMhVlMLW2vpOdQYyAp7whI-rRqCruq6VnmR_rToH53WIbmvkXlmmiYQxw3WoY0HRj2rkctz8HDwqxvsKqw1tjfrV8jBtchQeMXoyt8olN6iUvHwDhKf2BjiuPd2TNHn2Q4FGMd9K3ZssOh8hWMYNZq9D3nkd5RHPEBzSSttUL_sFlM59WXAwBtmRZ3GlHOUmws5L1n2F4T9eKqwtv0Hpy_vLZaMxxzidMoHnuDXPXngatMpDtj7qhIWHlUEQ9nJjBcZ32QbOvPSK1E8jL8272Ts26yzqvh4slbS112ZYK_HHn1ulXQOlYwfi3yzzmd1keeL9eqwXOXzTVqm6YqVZS5W5bIkB7rJluVM0VIoV6AykTeNvukhwmGy2M1kQVJCUlxM5ilZLJL1uiR5Rg7lUmSrZc6jPBV49KnreT-zRb8lLNLhpJLOu9skdU5WWog-HeLTztfGFswxK5tKzPrcRb_3v2GOB7M">