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

via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 23 03:54:15 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Congcong Cai (HerrCai0907)

<details>
<summary>Changes</summary>

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


---
Full diff: https://github.com/llvm/llvm-project/pull/117430.diff


1 Files Affected:

- (modified) clang/lib/Parse/ParseStmt.cpp (+1-1) 


``````````diff
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.

``````````

</details>


https://github.com/llvm/llvm-project/pull/117430


More information about the cfe-commits mailing list