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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] bugprone-derived-method-shadowing-base-method warns about documented usage of RecursiveASTVisitor
        </td>
    </tr>

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

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

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

<pre>
    We have some code implementing AST visitors following [this user guide](https://clang.llvm.org/docs/RAVFrontendAction.html#using-the-recursiveastvisitor).

Upon activating the `bugprone-derived-method-shadowing-base-method` check, it triggers warnings:

```cpp
template <typename T>
struct RecursiveASTVisitor
{
    void VisitDecl();
};

struct MyVisitor : RecursiveASTVisitor<MyVisitor>
{
    void VisitDecl();
};
```

```
source>:9:5: warning: 'MyVisitor::VisitDecl' shadows method with the same name in class 'RecursiveASTVisitor<MyVisitor>' [bugprone-derived-method-shadowing-base-method]
    9 |     void VisitDecl();
      |     ^
<source>:4:5: note: previous definition of 'VisitDecl' is here
    4 |     void VisitDecl();
      |     ^
1 warning generated.
```

https://godbolt.org/z/9WEqoM1P9

So I wonder if:

* The check should skip CRTP constructs.
* The TraverseASTVisitor base class should use different names.
* The user should just `NOLINT` this warning.

?


</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVMFu2zgQ_ZrxZWBDIi3LOuig2DVQYNstEm97psmxxJYmVZJSkH79grKSOt1isVnAgAhyPPPmzZsnQtCtJaqhuINivxBD7JyvpfDGhVaYkX70i5NTT_UXwk6MhMFdCKVThPrSG7qQjdq22DwccdRBR-cDnp0x7jFdQ3EXOx1wCOSxHbQiKPbAtl2MfQDeADsAO0gjbLsyZrysnG-BHZSTAdjhvvl88M5GsqqRUTu76uLFAOND0LZdxo6WnuTggx5JhDjXB1atIGsga_7qnUUhox7F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