[PATCH] D118104: Make run-clang-tidy.py print the configured checks correctly

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 4 04:22:04 PST 2022


njames93 added a comment.

In D118104#3296340 <https://reviews.llvm.org/D118104#3296340>, @salman-javed-nz wrote:

> In D118104#3292862 <https://reviews.llvm.org/D118104#3292862>, @JesApp wrote:
>
>> Well, since this was more of source of confusion than actual incorrect behaviour, I don't think there should be a test for it.
>>
>> In general though, I think the script is complex enough to warrant some testing. That being said: I don't think they should be part of this patch. Also, I'm doing this on company time and I don't think my boss would be to happy if I wrote a testsuite from scratch when I just wanted to fix one bug. :D
>
> The idea I had was a file in `clang-tools-extra\test\clang-tidy\infrastructure` with something like this:
>
>   // RUN: %run_clang_tidy -checks="-*,google-explicit-constructor,modernize-use-auto" %s | FileCheck -check-prefix=CHECK-ENABLED-CHECKS-1 %s
>   // CHECK-ENABLED-CHECKS-1: Enabled checks:
>   // CHECK-ENABLED-CHECKS-1-NEXT: google-explicit-constructor
>   // CHECK-ENABLED-CHECKS-1-NEXT: modernize-use-auto
>   
>   // RUN: %run_clang_tidy -checks="-*,google-explicit-constructor,modernize-use-auto" -config "Checks: -modernize-use-auto" %s | FileCheck -check-prefix=CHECK-ENABLED-CHECKS-2 %s
>   // CHECK-ENABLED-CHECKS-2: Enabled checks:
>   // CHECK-ENABLED-CHECKS-2-NEXT: google-explicit-constructor
>   // CHECK-ENABLED-CHECKS-2-NOT: modernize-use-auto
>
> Note: I haven't tested this. If it doesn't work, then it's probably a minor tweak away from working.
>
> This would confirm that the "Enabled checks:" message reflects the combined results of `-checks` and `-config` arguments.
> I was wondering whether a test like the one above was an easy enough win to consider bundling in with the fix. In my initial comment I just wanted to bring up the topic, not to make a call on whether it should be done or not.

FWIW the `--checks` option takes priority over the `--config` option. 
If a check is enabled via `--checks`, but disabled via `--config`, the check will be enabled. 
If a check is disabled via `--checks`, but enabled via `--config`, the check will be disabled.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118104/new/

https://reviews.llvm.org/D118104



More information about the cfe-commits mailing list