commit | 663733e9a0cfa1aae3644169d5f71b69db7be408 | [log] [tgz] |
---|---|---|
author | Anders Carlsson <andersca@mac.com> | Wed Oct 10 20:50:11 2007 +0000 |
committer | Anders Carlsson <andersca@mac.com> | Wed Oct 10 20:50:11 2007 +0000 |
tree | 0901bcfb9d9842d53697715bd3f16ce42b8a2315 | |
parent | 3eddc86bdbfa08702f3e2c6bc4b20bfeb0f7c24d [diff] [blame] |
Emit a warning when the body of an if block is a NullStmt. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42840 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/if-empty-body.c b/test/Sema/if-empty-body.c new file mode 100644 index 0000000..1dc9e44 --- /dev/null +++ b/test/Sema/if-empty-body.c
@@ -0,0 +1,9 @@ +// RUN: clang -parse-ast -verify %s + +void f1(int a) { + if (a); // expected-warning {{if statement has empty body}} +} + +void f2(int a) { + if (a) {} +}