summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/nolint.cpp
diff options
context:
space:
mode:
authorMatthias Gehre <M.Gehre@gmx.de>2016-09-24 16:06:53 +0000
committerMatthias Gehre <M.Gehre@gmx.de>2016-09-24 16:06:53 +0000
commit41a83a7d2b654de40bc623821ff111e56191236c (patch)
tree98cdb1bc879f0d4d8438b7b1853d6d673179ed5e /clang-tools-extra/test/clang-tidy/nolint.cpp
parent907cde3cc2e96b8558960641d2d2c78870a019b4 (diff)
downloadbcm5719-llvm-41a83a7d2b654de40bc623821ff111e56191236c.tar.gz
bcm5719-llvm-41a83a7d2b654de40bc623821ff111e56191236c.zip
[clang-tidy] fix for NOLINT after macro expansion
Summary: When having ``` c++ #define MACRO code-with-warning MACRO; // NOLINT ``` clang-tidy would still show the warning, because it searched for "NOLINT" only in the first line, not on the second. This caused e.g. https://llvm.org/bugs/show_bug.cgi?id=29089 (where the macro was defined in a system header). See also the added test cases. Now clang-tidy looks at the line of macro invocation and every line of macro definition for a NOLINT comment. Reviewers: alexfh, aaron.ballman, hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24845 llvm-svn: 282330
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/nolint.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/nolint.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/clang-tools-extra/test/clang-tidy/nolint.cpp b/clang-tools-extra/test/clang-tidy/nolint.cpp
index 980e904cbbf..7def5f35b3d 100644
--- a/clang-tools-extra/test/clang-tidy/nolint.cpp
+++ b/clang-tools-extra/test/clang-tidy/nolint.cpp
@@ -13,4 +13,18 @@ void f() {
int j; // NOLINT
}
-// CHECK-MESSAGES: Suppressed 3 warnings (3 NOLINT)
+#define MACRO(X) class X { X(int i); };
+MACRO(D)
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: single-argument constructors must be marked explicit
+MACRO(E) // NOLINT
+
+#define MACRO_NOARG class F { F(int i); };
+MACRO_NOARG // NOLINT
+
+#define MACRO_NOLINT class G { G(int i); }; // NOLINT
+MACRO_NOLINT
+
+#define DOUBLE_MACRO MACRO(H) // NOLINT
+DOUBLE_MACRO
+
+// CHECK-MESSAGES: Suppressed 7 warnings (7 NOLINT)
OpenPOWER on IntegriCloud