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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] Fix unit test readability/identifier-naming-anon-record-fields.cpp
        </td>
    </tr>

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

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

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

<pre>
    After [making clang-tidy skip processing system headers by default](https://github.com/llvm/llvm-project/pull/128150), the follow test case no longer works:

https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-anon-record-fields.cpp#L36

This is because the `CXXRecordDecl` corresponding to the global anonymous union is **not** picked up by the `ASTConsumer::handleTopLevelDecl` function, i.e. it is not considered a top-level declaration. Most likely because it's anonymous i.e. it does not have a name. Due to this, the AST traversal does not find it and so the check cannot process this case.


</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycU8GOozgQ_RpzKQWBCdA5cMh0xGn2stOHuRZ2Ad4YG7lMZrJfvzLpbPe1R0ICVK73_KreQ2YzOaJO1N9Efclwi7MPncJgPU9ob_Tvmg1e37vzGCmAqL8teDVuAmXRTYdo9B34alZYg1fEnEp850gLzISaAsNwB00jbjaK-iLkyxzjyqI6C9kL2U8mztuQK78I2Vt7e74Oa_D_kIpC9utmrZB9KV_KuhDyJOQrxJlg9Nb6XxCJIyhkAufBejdRgF8-XHeOIj1fZhysH4TsFzROyP5dqveWD_Q7BhSyT6QfJaPv6WcmdaXAQvaBUONgrImpYDS5aEZD4eBwMW46oPPuEEj5oA-jIas5V-sqZPW9ah53fpsNg2EYSOHGtAsWTfH68-ffe9uFlBVNAcqHQLx6p9Poo98PTtYPaCGx3Be_MWzOeJfghDwLeXY-Pj5gNepKGrY1remd4_zj7dU73hYKaWjVeUanLb359TvdyD6Zx82paLxL6zA55WBiYnA-gvKOjaZAGhCiXw82NYImZTFgasrhL88RrLmSvf8v0kQhW_507yeu9vRAnvFGgOBwoRwuGz0UG3564vzjDWLAGwVG-9E2GqcTDjoN_JjRvi1Q6FL93b071O6l_LGFTHeVPlUnzKgr22N5ak-yrbK5k8exke2xqFEiYT0qoqYsKzq1ZVMr1WSmk4Wsi6o8lqeiratcVu2gVFO1x7Kqm5ejOBa0oLF58l7uw5QZ5o26siqr9iWzOJDlPZdSfraZTDkN3e7YYZtYHAtrOPIHTjTR7on-1FZfoDe_kw_iIzB_5tBsC7b7cpx2YSkW79punfwvAAD__1bOgQ0">