summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/check_clang_tidy.cpp
diff options
context:
space:
mode:
authorZinovy Nis <zinovy.nis@gmail.com>2018-04-21 15:23:56 +0000
committerZinovy Nis <zinovy.nis@gmail.com>2018-04-21 15:23:56 +0000
commiteba2857bed15028b6e2d2be3640b1de4c6957037 (patch)
treea0be7527e04fb191ea9f22f6ab0b84baa43e4c60 /clang-tools-extra/test/clang-tidy/check_clang_tidy.cpp
parent93b102cd459e60b4c60648f17f956bb3f66b0c97 (diff)
downloadbcm5719-llvm-eba2857bed15028b6e2d2be3640b1de4c6957037.tar.gz
bcm5719-llvm-eba2857bed15028b6e2d2be3640b1de4c6957037.zip
[clang-tidy] Customize FileCheck prefix in check_clang-tidy.py
The patch introduces a new command line option '-check-suffix' for check_clang_tidy.py to allow multiple %check_clang_tidy% in a single test file. Sample: // RUN: %check_clang_tidy -check-suffix=FLAG-1 %s misc-unused-using-decls %t -- -- <options-set-1> // RUN: %check_clang_tidy -check-suffix=FLAG-2 %s misc-unused-using-decls %t -- -- <options-set-2> ... +// CHECK-MESSAGES-FLAG-1: :[[@LINE-4]]:10: warning: using decl 'B' is unused [misc-unused-using-decls] +// CHECK-MESSAGES-FLAG-2: :[[@LINE-7]]:10: warning: using decl 'A' is unused [misc-unused-using-decls] +// CHECK-FIXES-FLAG-1-NOT: using a::A;$ +// CHECK-FIXES-FLAG-2-NOT: using a::B;$ Differential Revision: https://reviews.llvm.org/D45776 llvm-svn: 330511
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/check_clang_tidy.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/check_clang_tidy.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/check_clang_tidy.cpp b/clang-tools-extra/test/clang-tidy/check_clang_tidy.cpp
new file mode 100644
index 00000000000..5c1bf92eecd
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.cpp
@@ -0,0 +1,21 @@
+// RUN: %check_clang_tidy -check-suffix=USING-A %s misc-unused-using-decls %t -- -- -DUSING_A
+// RUN: %check_clang_tidy -check-suffix=USING-B %s misc-unused-using-decls %t -- -- -DUSING_B
+// RUN: %check_clang_tidy %s misc-unused-using-decls %t
+
+namespace a {class A {}; class B {}; class C {}; }
+namespace b {
+#if defined(USING_A)
+using a::A;
+#elif defined(USING_B)
+using a::B;
+#else
+using a::C;
+#endif
+}
+namespace c {}
+// CHECK-MESSAGES-USING-A: :[[@LINE-8]]:10: warning: using decl 'A' {{.*}}
+// CHECK-MESSAGES-USING-B: :[[@LINE-7]]:10: warning: using decl 'B' {{.*}}
+// CHECK-MESSAGES: :[[@LINE-6]]:10: warning: using decl 'C' {{.*}}
+// CHECK-FIXES-USING-A-NOT: using a::A;$
+// CHECK-FIXES-USING-B-NOT: using a::B;$
+// CHECK-FIXES-NOT: using a::C;$
OpenPOWER on IntegriCloud