[clang] ed1d90c - [clang][NFC] simplify the unset check in `ParseLabeledStatement` (#117430)

via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 23 18:59:44 PST 2024


Author: Congcong Cai
Date: 2024-11-24T10:59:41+08:00
New Revision: ed1d90ca11b1834e667e17255ba2ecf6fe305e8c

URL: https://github.com/llvm/llvm-project/commit/ed1d90ca11b1834e667e17255ba2ecf6fe305e8c
DIFF: https://github.com/llvm/llvm-project/commit/ed1d90ca11b1834e667e17255ba2ecf6fe305e8c.diff

LOG: [clang][NFC] simplify the unset check in `ParseLabeledStatement` (#117430)

`!isInvalid && !isUsable -> !isInvalid && !(!isInvalid && !isUnset) ->
isUnset`
It is more simple to understand.

Added: 
    

Modified: 
    clang/lib/Parse/ParseStmt.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index f6d787a0c88319..cd4504630f8719 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -799,7 +799,7 @@ StmtResult Parser::ParseLabeledStatement(ParsedAttributes &Attrs,
   }
 
   // If we've not parsed a statement yet, parse one now.
-  if (!SubStmt.isInvalid() && !SubStmt.isUsable())
+  if (SubStmt.isUnset())
     SubStmt = ParseStatement(nullptr, StmtCtx);
 
   // Broken substmt shouldn't prevent the label from being added to the AST.


        


More information about the cfe-commits mailing list