================
@@ -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
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to