summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/explain-checks.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2016-04-27 09:15:01 +0000
committerHaojian Wu <hokein@google.com>2016-04-27 09:15:01 +0000
commit12e6b8f92963b2a49c913d24fff0d75b03679b19 (patch)
treed135c4b58d02483a695f0d2c20d5fd14642aedc6 /clang-tools-extra/test/clang-tidy/explain-checks.cpp
parenta785640e83cefcbbcbdfc71a1425f3830d404fa6 (diff)
downloadbcm5719-llvm-12e6b8f92963b2a49c913d24fff0d75b03679b19.tar.gz
bcm5719-llvm-12e6b8f92963b2a49c913d24fff0d75b03679b19.zip
[ClangTidy] Add an 'explain-checks' option to diagnose where each checks comes from.
Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18694 llvm-svn: 267683
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/explain-checks.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/explain-checks.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/explain-checks.cpp b/clang-tools-extra/test/clang-tidy/explain-checks.cpp
new file mode 100644
index 00000000000..b1865e715c1
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/explain-checks.cpp
@@ -0,0 +1,14 @@
+// RUN: clang-tidy -checks=-*,modernize-use-nullptr -explain-config | FileCheck --check-prefix=CHECK-MESSAGE1 %s
+// RUN: clang-tidy -config="{Checks: '-*,modernize-use-nullptr'}" -explain-config | FileCheck --check-prefix=CHECK-MESSAGE2 %s
+// RUN: clang-tidy -checks=modernize-use-nullptr -config="{Checks: '-*,modernize-use-nullptr'}" -explain-config | FileCheck --check-prefix=CHECK-MESSAGE3 %s
+// RUN: clang-tidy -checks=modernize-use-nullptr -config="{Checks: '-*,-modernize-use-nullptr'}" %S/Inputs/explain-config/a.cc -explain-config | FileCheck --check-prefix=CHECK-MESSAGE4 %s
+// RUN: clang-tidy -checks=modernize-use-nullptr -config="{Checks: '-*,modernize-*'}" -explain-config | FileCheck --check-prefix=CHECK-MESSAGE5 %s
+// RUN: clang-tidy -config="{Checks: 'modernize-use-nullptr'}" -explain-config | FileCheck --check-prefix=CHECK-MESSAGE6 %s
+// RUN: clang-tidy -explain-config %S/Inputs/explain-config/a.cc | grep "'modernize-use-nullptr' is enabled in the %S/Inputs/explain-config/.clang-tidy."
+
+// CHECK-MESSAGE1: 'modernize-use-nullptr' is enabled in the command-line option '-checks'.
+// CHECK-MESSAGE2: 'modernize-use-nullptr' is enabled in the command-line option '-config'.
+// CHECK-MESSAGE3: 'modernize-use-nullptr' is enabled in the command-line option '-checks'.
+// CHECK-MESSAGE4: 'modernize-use-nullptr' is enabled in the command-line option '-checks'.
+// CHECK-MESSAGE5: 'modernize-use-nullptr' is enabled in the command-line option '-checks'.
+// CHECK-MESSAGE6: 'clang-analyzer-unix.API' is enabled in the clang-tidy binary.
OpenPOWER on IntegriCloud