[all-commits] [llvm/llvm-project] 37b881: clang: Tweak behaviour of warn_empty_while_body an...
Dmitri Gribenko via All-commits
all-commits at lists.llvm.org
Thu Jun 23 17:40:45 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 37b881aa0bca09b7cc80575cc4b97453aa724186
https://github.com/llvm/llvm-project/commit/37b881aa0bca09b7cc80575cc4b97453aa724186
Author: Dmitri Gribenko <gribozavr at gmail.com>
Date: 2022-06-24 (Fri, 24 Jun 2022)
Changed paths:
M clang/lib/Sema/SemaChecking.cpp
M clang/lib/Sema/SemaStmt.cpp
M clang/test/CXX/stmt.stmt/stmt.select/p3.cpp
M clang/test/SemaCXX/warn-empty-body.cpp
Log Message:
-----------
clang: Tweak behaviour of warn_empty_while_body and warn_empty_if_body
Use the if/while statement right paren location instead of the end of the
condition expression to determine if the semicolon is on its own line, for the
purpose of not warning about code like this:
while (foo())
;
Using the condition location meant that we would also not report a warning on
code like this:
while (MACRO(a,
b));
body();
The right paren loc wasn't stored in the AST or passed into Sema::ActOnIfStmt
when this logic was first written.
Reviewed By: rnk, gribozavr2
Differential Revision: https://reviews.llvm.org/D128406
More information about the All-commits
mailing list