================
@@ -997,6 +1014,14 @@ StmtResult Sema::ActOnIfStmt(SourceLocation IfLoc,
   if (!ConstevalOrNegatedConsteval && !elseStmt)
     DiagnoseEmptyStmtBody(RParenLoc, thenStmt, diag::warn_empty_if_body);
 
+  if (isa<DeferStmt>(thenStmt))
+    Diag(thenStmt->getBeginLoc(), diag::warn_redundant_defer)
+        << thenStmt->getSourceRange();
+
+  if (elseStmt && isa<DeferStmt>(elseStmt))
+    Diag(elseStmt->getBeginLoc(), diag::warn_redundant_defer)
+        << elseStmt->getSourceRange();
+
----------------
Expertcoderz wrote:

@Sirraide I've opened the NFC as #226101.

https://github.com/llvm/llvm-project/pull/225748
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to