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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] Errors on cross-compilation flags
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          tq-steina
      </td>
    </tr>
</table>

<pre>
    When using clang-tidy while cross-compiling, e.g. `arm-none-eabi-gcc` (ARM toolchain arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi for ARMv7) clangy-tidy errors out on unsupported (target-specific) compiler-flags. I was able to bisect it to commit a2a51448c1c34ee1cd1c3ec3689e7a354bb0df7c.

Apparently cross-compilation flags, e.g. `-mcpu` are validated against host-toolchain of clang-tidy

## commit a2a51448c1c34ee1cd1c3ec3689e7a354bb0df7c
```
error: unsupported option '-mcpu=' for target 'x86_64-unknown-linux-gnu' [clang-diagnostic-error]
```

## commit a2a51448c1c34ee1cd1c3ec3689e7a354bb0df7c
```
warning: argument unused during compilation: '-mcpu=cortex-m7' [clang-diagnostic-unused-command-line-argument]
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVEuPqzYU_jVmYxmBzSNZsMg0jdTFbGbTZXUwB3BrbOpHMvn3lSG9k9G9s7jSlaIgg8_5XscG79VkEDtSv5D6nEEMs3Vd-Jf5gMpA1tvh3v05o6HRKzNRqcFMLKjhTm-z0kils94zaZdVaWUmwn-jmE85JU0BbmHGGmQIvWKTlKQpKOGH09srDdZqOYMyNO2aTGTf3rCS5zx3qEv2fmj-air2qREdraOnt9drS_hx53PfCaFz1nlqY6DW0Gh8XFfrAg4JNICbMDC_olSjklvtRhodGzVMPqd_0Bt4Cr1GGiztlUcZqAppIe2yqECBQ11W1UGWUlSIpRxKKVCK5nDEFkRd9X0xjK3MSXEmxWn_P60rODRB3z-ZBUFZQzfoZ9PYIteYjAKH9ApaDZAUwATK-EBn68OHVdSOT4k8gxIuCBc_y_tR2xSP37bcbCXi9MlRu270CW93wuJMeLtFsxudvjzSi-YfY2-GaWXie4o67ST1y058UDAZ64OSbAeqzz9k8ctl3cCZNLDiRMFNcUETaDTR40CH6LZZ_8gp7XrSKpMJ72xpv5KyN0pJL2CGJB3Z_yjfK8yGTgxHcYQMu7LlXFT1gdfZ3CGvmvaIKEUxCnmsZQuVHGHoYWyl6CFTHS94VbSiKAUXlchLycdeYtO02Nb8IElV4AJK51pfl9y6KVPeR-zKoiwPdaahR-2308_50yRxnm4D16Uq1sfJk6rQygf_0SeooLd746msPtPfH4fQfDXsWXS6m0NYPREnwi-EXyYV5tjn0i6EXxLA48FWZ_9GGQi_bKw94ZcH8WvH_wsAAP__Iq6CZQ">