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

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


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

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


>From 61d17293801b552b40e78bc1277cea1c83741e56 Mon Sep 17 00:00:00 2001
From: Congcong Cai <congcongcai0907 at 163.com>
Date: Sat, 23 Nov 2024 19:51:50 +0800
Subject: [PATCH] [clang][NFC] simplify the check for `ParseLabeledStatement`

`!isInvalid && !isUsable -> !isInvalid && !(!isInvalid && !isUnset) -> isUnset`
It is more simple to understand.
---
 clang/lib/Parse/ParseStmt.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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