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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] False positive for misc-unused-parameters
        </td>
    </tr>

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

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

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

<pre>
    Code in `test.H`:
```
int myFunction(input_t level)
{
    auto orders = level.orders();
    return orders;
}

```

Command:
```bash
$ clang-tidy -checks="-*,misc-unused-parameters" /path/to/test.H
```

Output:
```
Error while trying to load a compilation database:
Could not auto-detect compilation database for file "/path/to/test.H"
No compilation database found in /path/to or any parent directory
fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
1 warning and 1 error generated.
Error while processing /devsandbox/hfdev/igandhi/csdlc/templates/test.H.
/devsandbox/hfdev/igandhi/csdlc/templates/test.H:1:16: error: unknown type name 'input_t' [clang-diagnostic-error]
int myFunction(input_t level)
               ^
/devsandbox/hfdev/igandhi/csdlc/templates/test.H:1:24: warning: parameter 'level' is unused [misc-unused-parameters]
int myFunction(input_t level)
                       ^~~~~
                        /*level*/
Found compiler error(s).
```

What I would want to happen is the error to be reported, but not the warning.

Interestingly, that is what happens if you just change the function _slightly_:
```
int myFunction(input_t level)
{
    return level.orders();
}
```

Using clang-tidy on that, you get:
```
$ clang-tidy -checks="-*,misc-unused-parameters" /path/to/test.H
Error while trying to load a compilation database:
Could not auto-detect compilation database for file "/path/to/test.H"
No compilation database found in /path/to or any parent directory
fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
1 error generated.
Error while processing /path/to/test.H.
Found compiler error(s).
/test.H:1:16: error: unknown type name 'input_t' [clang-diagnostic-error]
int myFunction(input_t level)
               ^
```

clang-tidy v13.0.0
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztVk2P2zYQ_TXyZSBBpix7fdAhWcdIckiAFkWPC0qkJW5oUuCHHf37DCnFUbv2otskQAvE8FoUyRm-9zgfW2s2VPeacRAKknXuuHXZWxwkxask3yX5qzAev_FVKAfHYe9V44RWCbkTqvfuwYHkJy4Tsp2sNq_HAeCHeqdBG8aNhaTYjVuzcQI9BKNitt1w542aDC4ryWY3Da7BGn_v9fFIFXuKvaa2m6bIChpJVZs6wQZIm443n_CUXUJImhBcvz8K26ReectZ2lNDj9xFoAQSsu-p6_DhdPgZxbqN56N3KM4tKd8Yow2cOyE5ODMI1QLqJDVlQKHRx15IGkQGRh1FBvzi6F57yUBpF6VNGQJs3FUTOOARh3AC4r8OH-ej0w_6lgevWAyPmTneDlA1AOrDMSKYMIhAm2F0dRCfUbuZt3RGAea8dc9VIB4t5kQB4VjfdCN43P-3Ix4ten3JCe9___jhJQf85lW0OwvXae_gIGlrs3FtCWdq4ipGGyyBx_NarrihjrPs6f32Rjfc2mCC-jF-smhZ68_40h3wFZ-ixalO4KixTDbxgo49suP2clnZ1yD-9y6Q-jL8rYMGEXgYePVJ6bMCN_QcFIY8wtxMqY0jSMrXY9YwQVulrRNNOhqXuxcVBvjrJynf_DBKZBWYTDcThpfkDWQmGBsQFsbkDqRu5Pr3kZqT28y-z-0NYYHlZ_Ib5Bi372P2jYGOREbNyR2S32bPVJ4_O-rgHZxjoThTpIE529EekyEI4Do-BS1O1xxLbq8NRi5WP6gx2ENpCXsmMbO563cKJULdcV4OwcCFs9DpOTzHMyyIAwzaw6O3WJg6jBweHR4mKeHBStF2Tg4PP7LTTK3jmQbzrY1ck-2PmKGz_oBIA71AM9Bp-c1q_rMay68u8f_tEi_tC091z_5xFfiv1_dr6TbLl9OyyPIsX7CqYNtiSxdOOMmrC66wCbHAnkqMtl5b4cRpDNzrabXwRladc70NCRGK677FS_J1hjLii5Snr48Ub-ERbzW0G2t97CzlelmSRVexuyUt2Jrly-0dybersixIyRtOluWKrvl6IWnNpQ1AMUcUP0N0EfKl3C1ERXJC8jVZkrzcltuswH9FKS0PJcvrYlUXySrnRypkFnBgxWoXpoqQat9aXJTCOvttkWKotIpHXYJ_TOxOm0rYjqJIsVMu4vlVxP8FATPBBQ">