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

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy: bugprone-unchecked-optional-access regression (hang) from 15.0.7 to 16.0.6
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

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

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

<pre>
    [test.zip](https://github.com/llvm/llvm-project/files/12926296/test.zip)

With attached file if you run (with clang/llvm 15.0.7):

```sh
for i in $(seq 1 10); do clang-tidy test.cpp -checks='-*,bugprone-unchecked-optional-access'  -- --std=c++17; done
```

all works fine.

But with clang/llvm 16.0.6

it hangs on time from 2 minutes to more then several hours.

And it happens randomly, some times run takes several seconds, some times minutes or hours.
On my machine, running the clang-tidy (16.0.6) 10 times results in a 100% hang.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU82OozwQfJrm0gJBEyAcOCQT5fodv7MDDXjH2KzbzCj79CtgfjKjlVYrIZBwd1V1l0uJ6MEyN1CcobhEagmj881lkVFLcC_RzXX39TCwhOSXnqG4AB3HEGaB_AR0BboOOozLLWndBHQ15uX9E8_e_eA2AF17bViArhnVVFJdAl0_EKmG9ALpaX__r8OIKgTVjtzh2oe6x7tb0C8WgY6va0FrlB3eaDArkjSpVpz89AgFZbo_Mu4_eudRo15hDkBH4Z-YYZZunWfs3A4bB93dcZPXzjPG7cjts0B-AapioBPQ020ZZu8sx4vdTrmL3Ry0s8rEqm1ZBKhCjGOMYwkd5JcW6Ax0zqqdyfI3iY-6lTH46vyzYK8tJ49H5yXgHxZQJmlSPtbpgKOyg6CzGPTE2Hs3IeGk7RJYMDicnGcMI1sUfmGvDI5u8fKF7mQ73KDmma2gV7Zzk7kDPaG4iTdo2YwJ6pnlA0m4dbaTb3Xv5M5_ofrP4nTHSbWjtry2-MVabYdV3KMjQMe3QanGLH0nZ1lMkNVVhVmaAhXb6EnUNXlX57WKuMnKuiryrKqraGwqpcq0uhVZmdd9Vh76qi9KpkNFqiypvkW6oZTyLM2q9JiXeZVwnXXHVhVtpSrmvIRDypPSJlm3nzg_RFpk4aasqT5GRt3YyJYook_9QLQmzDdbNG7LIHBIjZYgnzBBB8PNQ09-wr_fNfQ8eBbRbgvIuN2Merd8z8bq9767aPGm-ef4buOt-d0m_B0AAP__4FJPgw">