[llvm-branch-commits] [clang] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)
Alexey Bataev via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed May 22 06:03:43 PDT 2024
================
@@ -9861,13 +9842,19 @@ buildPreInits(ASTContext &Context,
/// Build pre-init statement for the given statements.
static Stmt *buildPreInits(ASTContext &Context, ArrayRef<Stmt *> PreInits) {
- if (PreInits.empty())
- return nullptr;
-
- SmallVector<Stmt *> Stmts;
- for (Stmt *S : PreInits)
- appendFlattendedStmtList(Stmts, S);
- return CompoundStmt::Create(Context, PreInits, FPOptionsOverride(), {}, {});
+ if (!PreInits.empty()) {
+ SmallVector<Stmt *> Stmts;
+ for (Stmt *S : PreInits) {
+ // Do not nest CompoundStmts.
+ if (auto *CS = dyn_cast<CompoundStmt>(S)) {
+ llvm::append_range(Stmts, CS->body());
+ continue;
+ }
+ Stmts.push_back(S);
+ }
+ return CompoundStmt::Create(Context, PreInits, FPOptionsOverride(), {}, {});
+ }
+ return nullptr;
----------------
alexey-bataev wrote:
Original code should work correctly, no?
https://github.com/llvm/llvm-project/pull/92030
More information about the llvm-branch-commits
mailing list