[llvm-branch-commits] [clang] [flang] [llvm] [Clang][OpenMP] Add permutation clause (PR #92030)
Michael Kruse via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri May 24 15:20:08 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;
----------------
Meinersbur wrote:
I don't know why, but this patch contained the state before #91459's review. Fixed.
https://github.com/llvm/llvm-project/pull/92030
More information about the llvm-branch-commits
mailing list