summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/warn-empty-body.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX/warn-empty-body.cpp')
-rw-r--r--clang/test/SemaCXX/warn-empty-body.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/warn-empty-body.cpp b/clang/test/SemaCXX/warn-empty-body.cpp
index bd6b47f053f..0fc0cd51f93 100644
--- a/clang/test/SemaCXX/warn-empty-body.cpp
+++ b/clang/test/SemaCXX/warn-empty-body.cpp
@@ -301,3 +301,14 @@ void test7(int x, int y) {
if (x) IDENTITY(); // no-warning
}
+#define SOME_IF(A) if (A)
+#define IF_ELSE(A) if (A); else
+
+
+void test_macros() {
+ SOME_IF(0);
+ IF_ELSE(0);
+
+ IDENTITY(if (0);) // expected-warning{{if statement has empty body}} expected-note{{separate line}}
+ IDENTITY(if (0); else;) // expected-warning{{else clause has empty body}} expected-note{{separate line}}}
+}
OpenPOWER on IntegriCloud