Loosen -Wempty-body warning
authorReid Kleckner <rnk@google.com>
Fri, 17 Nov 2017 21:33:28 +0000 (21:33 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 17 Nov 2017 21:33:28 +0000 (21:33 +0000)
commitc0a81071d3d89c4e07f0ef39f5bb96eb9e6df76b
tree4f333696109dc564b84c0a320134b0642cd9d283
parent188efda585f1da5ab91eedfe75a292bf6b6fd803
Loosen -Wempty-body warning

Do not show it when `if` or `else` come from macros.
E.g.,

    #define USED(A) if (A); else
    #define SOME_IF(A) if (A)

    void test() {
      // No warnings are shown in those cases now.
      USED(0);
      SOME_IF(0);
    }

Patch by Ilya Biryukov!

Differential Revision: https://reviews.llvm.org/D40185

llvm-svn: 318556
clang/include/clang/Sema/Sema.h
clang/lib/Parse/ParseStmt.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaStmt.cpp
clang/test/SemaCXX/warn-empty-body.cpp