================
@@ -4052,11 +4094,15 @@ void Sema::ActOnDeferStmtError([[maybe_unused]] Scope
*CurScope) {
CurrentDefer.pop_back();
}
-StmtResult Sema::ActOnEndOfDeferStmt(Stmt *Body,
- [[maybe_unused]] Scope *CurScope) {
+StmtResult Sema::ActOnEndOfDeferStmt(Stmt *Body, Scope *CurScope) {
assert(!CurrentDefer.empty() && CurrentDefer.back().first == CurScope);
+
SourceLocation DeferLoc = CurrentDefer.pop_back_val().second;
DiagnoseEmptyStmtBody(DeferLoc, Body, diag::warn_empty_defer_body);
+
+ // Check for superfluous nested defer.
+ CheckRedundantDeferStmt(*this, Body);
+
----------------
Sirraide wrote:
```suggestion
SourceLocation DeferLoc = CurrentDefer.pop_back_val().second;
DiagnoseEmptyStmtBody(DeferLoc, Body, diag::warn_empty_defer_body);
CheckRedundantDeferStmt(*this, Body);
```
I don't think we need the comment or all the empty lines here
https://github.com/llvm/llvm-project/pull/225748
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits