]> granicus.if.org Git - clang/commit
Generalize -Wempty-body: warn when statement body is empty (closes: PR11329)
authorDmitri Gribenko <gribozavr@gmail.com>
Tue, 14 Feb 2012 22:14:32 +0000 (22:14 +0000)
committerDmitri Gribenko <gribozavr@gmail.com>
Tue, 14 Feb 2012 22:14:32 +0000 (22:14 +0000)
commit625bb569df0c34feec0d52c0ec5215f21ef2e054
tree9f7a16fe5b6215a62dcd9b2cd40f1f6ba9833c1a
parent66c40400e7d6272b0cd675ada18dd62c1f0362c7
Generalize -Wempty-body: warn when statement body is empty (closes: PR11329)

* if, switch, range-based for: warn if semicolon is on the same line.
* for, while: warn if semicolon is on the same line and either next
statement is compound statement or next statement has more
indentation.

Replacing the semicolon with {} or moving the semicolon to the next
line will always silence the warning.

Tests from SemaCXX/if-empty-body.cpp merged into SemaCXX/warn-empty-body.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150515 91177308-0d34-0410-b5e6-96231b3b80d8
19 files changed:
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/ScopeInfo.h
include/clang/Sema/Sema.h
lib/Parse/ParseObjc.cpp
lib/Parse/ParseStmt.cpp
lib/Sema/Sema.cpp
lib/Sema/SemaChecking.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaStmt.cpp
lib/Sema/TreeTransform.h
test/Analysis/misc-ps.m
test/Parser/cxx-condition.cpp
test/Parser/statements.c
test/Sema/default.c
test/Sema/statements.c
test/Sema/switch.c
test/SemaCXX/condition.cpp
test/SemaCXX/if-empty-body.cpp [deleted file]
test/SemaCXX/warn-empty-body.cpp [new file with mode: 0644]