[clang] 3d8d73a - [NFC] Fix the unreachable 'return' in OpenACC Stmt handling (#181153)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 12 07:04:54 PST 2026
Author: Erich Keane
Date: 2026-02-12T15:04:49Z
New Revision: 3d8d73a7f98aabd23b02e8ebe1a2bcf9dce3752e
URL: https://github.com/llvm/llvm-project/commit/3d8d73a7f98aabd23b02e8ebe1a2bcf9dce3752e
DIFF: https://github.com/llvm/llvm-project/commit/3d8d73a7f98aabd23b02e8ebe1a2bcf9dce3752e.diff
LOG: [NFC] Fix the unreachable 'return' in OpenACC Stmt handling (#181153)
A result of various cleanups, reimplementations/etc, I ended up with a
return after an if/else branch where each returned in #168422.
This patch removes the 'else' after a return, and removes the
unreachable return.
Added:
Modified:
clang/lib/AST/StmtOpenACC.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/StmtOpenACC.cpp b/clang/lib/AST/StmtOpenACC.cpp
index ec8ceb949c6c0..2191c6a072264 100644
--- a/clang/lib/AST/StmtOpenACC.cpp
+++ b/clang/lib/AST/StmtOpenACC.cpp
@@ -513,32 +513,31 @@ getCaptureStmtInfo(const Stmt *AssocStmt) {
Read = getReadStmtInfo(Stmt2);
return OpenACCAtomicConstruct::StmtInfo::createUpdateRead(*Update, *Read);
- } else {
- // All of the forms that can be done in a single line fall into 2
- // categories: update/read, or read/update. The special cases are the
- // postfix unary operators, which we have to make sure we do the 'read'
- // first. However, we still parse these as the RHS first, so we have a
- // 'reversing' step. READ: UPDATE v = x++; v = x--; UPDATE: READ v = ++x; v
- // = --x; v = x binop=expr v = x = x binop expr v = x = expr binop x
+ }
- const Expr *E = cast<const Expr>(AssocStmt);
+ // All of the forms that can be done in a single line fall into 2
+ // categories: update/read, or read/update. The special cases are the
+ // postfix unary operators, which we have to make sure we do the 'read'
+ // first. However, we still parse these as the RHS first, so we have a
+ // 'reversing' step. READ: UPDATE v = x++; v = x--; UPDATE: READ v = ++x; v
+ // = --x; v = x binop=expr v = x = x binop expr v = x = expr binop x
- std::optional<OpenACCAtomicConstruct::SingleStmtInfo> Read =
- getReadStmtInfo(E, /*ForAtomicComputeSingleStmt=*/true);
- std::optional<OpenACCAtomicConstruct::SingleStmtInfo> Update =
- getUpdateStmtInfo(Read->X);
+ const Expr *E = cast<const Expr>(AssocStmt);
- // Fixup this, since the 'X' for the read is the result after write, but is
- // the same value as the LHS-most variable of the update(its X).
- Read->X = Update->X;
+ std::optional<OpenACCAtomicConstruct::SingleStmtInfo> Read =
+ getReadStmtInfo(E, /*ForAtomicComputeSingleStmt=*/true);
+ std::optional<OpenACCAtomicConstruct::SingleStmtInfo> Update =
+ getUpdateStmtInfo(Read->X);
- // Postfix is a read FIRST, then an update.
- if (Update->IsPostfixIncDec)
- return OpenACCAtomicConstruct::StmtInfo::createReadUpdate(*Read, *Update);
+ // Fixup this, since the 'X' for the read is the result after write, but is
+ // the same value as the LHS-most variable of the update(its X).
+ Read->X = Update->X;
- return OpenACCAtomicConstruct::StmtInfo::createUpdateRead(*Update, *Read);
- }
- return {};
+ // Postfix is a read FIRST, then an update.
+ if (Update->IsPostfixIncDec)
+ return OpenACCAtomicConstruct::StmtInfo::createReadUpdate(*Read, *Update);
+
+ return OpenACCAtomicConstruct::StmtInfo::createUpdateRead(*Update, *Read);
}
const OpenACCAtomicConstruct::StmtInfo
More information about the cfe-commits
mailing list