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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] bugprone-unchecked-optional-access does not seem "aware of common macros" as docs state.
        </td>
    </tr>

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

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

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

<pre>
    These docs suggest it will recognize macros like D/CHECK and ASSERT_THAT.
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/unchecked-optional-access.html#ensure-that-a-value-exists-using-common-macros

But I don't believe it actually recognizes the _macro names_. It only seems to work if the checker is able to expand the macro to a return statement or stdlib assertion.

See this example: https://godbolt.org/z/xPKvqT9qv
1. Pass: `CHECK_ASSERT`, calling `assert` from `assert.h`
2. Pass: `CHECK_RETURN`, directly returning before value access
3. Fail: `CHECK`, calling an extern handler
    * I'm interested in this case, with different handlers for embedded and for unit tests.

For some more supporting evidence, there are no examples of this in the [checker's unit tests](https://github.com/llvm/llvm-project/blob/main/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVM1u4zgTfBr60pAgU5btHHxwfoQJBt-3g8RzDiiyLXFDkRp2y3bm6ReUnE1msHvYi3_YZLG6i1WKyLYecSeqW1HdL9TIXYg71TjFHuOiCeZtd-iQEEzQBDS2LRKDZThb5yCiDq23PxF6pWMgcPYV4V7I-u7Lw91XUN7A_vn54enwcviyP-SiuBfFvmMeSJR7IWsha-2Ub3PnTn0eYitkjReO6r2QsTVv6U-H-pWErJuxHWLwKGQ9-mkVTRYGtsErlymtkSjvuHdCluhpjJhxpzhT2Um5ETO8WGLKRrK-zXTo--CzmfxMbv68HRkewQQv5IahQWfxhKltpXlUzr19tE7AHcLLh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