summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2017-12-14 16:13:57 +0000
committerAaron Ballman <aaron@aaronballman.com>2017-12-14 16:13:57 +0000
commitffd3d6489a842b5e2b5da6eed099b3c730ebb9ba (patch)
tree7d3415d2d9d315418d5d3c72a8200980b8441efe /test
parent64b8582ecca09bf279c5a815a82486befcf50341 (diff)
Add support for NOLINT and NOLINTNEXTLINE comments mentioning specific check names.
Supports a comma-separated list of check names to be disabled on the given line. Also supports * as a wildcard to disable all lint diagnostic messages on that line. Patch by Anton (xgsa). git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@320713 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/clang-tidy/nolint.cpp15
-rw-r--r--test/clang-tidy/nolintnextline.cpp20
2 files changed, 31 insertions, 4 deletions
diff --git a/test/clang-tidy/nolint.cpp b/test/clang-tidy/nolint.cpp
index 7e828bfd..893e8192 100644
--- a/test/clang-tidy/nolint.cpp
+++ b/test/clang-tidy/nolint.cpp
@@ -13,7 +13,18 @@ class A { A(int i); };
class B { B(int i); }; // NOLINT
-class C { C(int i); }; // NOLINT(we-dont-care-about-categories-yet)
+class C { C(int i); }; // NOLINT(for-some-other-check)
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit
+
+class C1 { C1(int i); }; // NOLINT(*)
+
+class C2 { C2(int i); }; // NOLINT(not-closed-bracket-is-treated-as-skip-all
+
+class C3 { C3(int i); }; // NOLINT(google-explicit-constructor)
+
+class C4 { C4(int i); }; // NOLINT(some-check, google-explicit-constructor)
+
+class C5 { C5(int i); }; // NOLINT without-brackets-skip-all, another-check
void f() {
int i;
@@ -35,4 +46,4 @@ MACRO_NOLINT
#define DOUBLE_MACRO MACRO(H) // NOLINT
DOUBLE_MACRO
-// CHECK-MESSAGES: Suppressed 8 warnings (8 NOLINT)
+// CHECK-MESSAGES: Suppressed 12 warnings (12 NOLINT)
diff --git a/test/clang-tidy/nolintnextline.cpp b/test/clang-tidy/nolintnextline.cpp
index d18f335c..a97928ae 100644
--- a/test/clang-tidy/nolintnextline.cpp
+++ b/test/clang-tidy/nolintnextline.cpp
@@ -4,8 +4,24 @@ class A { A(int i); };
// NOLINTNEXTLINE
class B { B(int i); };
-// NOLINTNEXTLINE(we-dont-care-about-categories-yet)
+// NOLINTNEXTLINE(for-some-other-check)
class C { C(int i); };
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit
+
+// NOLINTNEXTLINE(*)
+class C1 { C1(int i); };
+
+// NOLINTNEXTLINE(not-closed-bracket-is-treated-as-skip-all
+class C2 { C2(int i); };
+
+// NOLINTNEXTLINE(google-explicit-constructor)
+class C3 { C3(int i); };
+
+// NOLINTNEXTLINE(some-check, google-explicit-constructor)
+class C4 { C4(int i); };
+
+// NOLINTNEXTLINE without-brackets-skip-all, another-check
+class C5 { C5(int i); };
// NOLINTNEXTLINE
@@ -28,6 +44,6 @@ MACRO(G)
// NOLINTNEXTLINE
MACRO_NOARG
-// CHECK-MESSAGES: Suppressed 4 warnings (4 NOLINT)
+// CHECK-MESSAGES: Suppressed 8 warnings (8 NOLINT)
// RUN: %check_clang_tidy %s google-explicit-constructor %t --