[PATCH] D89936: [clang-tidy] adding "--clang-tidy-config=<file-path>" to specify custom config file
Hiral via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 28 07:12:29 PDT 2020
Hiralo marked an inline comment as done.
Hiralo added inline comments.
================
Comment at: clang-tools-extra/test/clang-tidy/infrastructure/config-file.cpp:2
+// REQUIRES: shell
+// RUN: clang-tidy --config-file=%S/Inputs/config-file/config-file %T/read-file-config/test.cpp | grep "warning: .*\[hicpp-uppercase-literal-suffix\]$"
+
----------------
Hiralo wrote:
> DmitryPolukhin wrote:
> > Please use `FileCheck` as all other tests do instead of `grep` to make test more portable. Also with `FileCheck` it should be no need in `REQUIRES: shell`.
> >
> > And I think it is better to use `-dump-config` instead of checking specific check on a source file. This way you will tests only functionality that you implemented, without dependency some check behavior. Also it could be just another tests case in clang-tidy/infrastructure/config-files.cpp.
> > Please use `FileCheck` as all other tests do instead of `grep` to make test more portable. Also with `FileCheck` it should be no need in `REQUIRES: shell`.
> >
> > And I think it is better to use `-dump-config` instead of checking specific check on a source file. This way you will tests only functionality that you implemented, without dependency some check behavior. Also it could be just another tests case in clang-tidy/infrastructure/config-files.cpp.
>
> Sure...
>
> Tried following...
>
> ```
> // RUN: clang-tidy -config-file=%S/Inputs/config-file/config-file -dump-config -- | FileCheck %s -check- prefix=CHECK-BASE
> // CHECK-BASE: Checks: {{.*}}hicpp-uppercase-literal-suffix
> // RUN: clang-tidy -config-file=%S/Inputs/config-file/config-file %S/config-file.cpp -- | FileCheck %s -check- prefix=CHECK-CHILD1
> // CHECK-CHILD1: Checks: {{.*}}warning: integer literal has suffix 'ull', which is not uppercase [hicpp-uppercase- literal-suffix] ########### This one fails!
> ```
>
> Can you please suggest how to match with following o/p:
>
> ```
> path/clang-tools-extra/test/clang-tidy/infrastructure/config-file.cpp:7:21: warning: integer literal has suffix 'ull', which is not uppercase [hicpp-uppercase-literal-suffix]
> unsigned long c = 100ull;
> ^ ~~~
> ULL
> ```
>
> JFYI: also tried matching just 'ULL'!
Removed below test...
// RUN: clang-tidy -config-file=%S/Inputs/config-file/config-file %S/config-file.cpp -- | FileCheck %s -check- prefix=CHECK-CHILD1
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89936/new/
https://reviews.llvm.org/D89936
More information about the cfe-commits
mailing list