[llvm-branch-commits] [clang] [Clang] [C++26] Expansion Statements (Part 7: Constexpr support and tests) (PR #169686)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jun 1 09:48:55 PDT 2026
================
@@ -6590,6 +6600,38 @@ bool Compiler<Emitter>::visitCXXTryStmt(const CXXTryStmt *S) {
return this->visitStmt(S->getTryBlock());
}
+/// template for (auto x : {1, 2}) {}
+///
+/// This is not a loop from an AST perspective at all since it has already
+/// been instantiated to a list of compound statements.
+///
+/// Since we can have control flow in those compound statements, we need to
+/// handle it mostly like a loop though.
+template <class Emitter>
+bool Compiler<Emitter>::visitCXXExpansionStmtInstantiation(
+ const CXXExpansionStmtInstantiation *S) {
+ LocalScope<Emitter> WholeLoopScope(this, ScopeKind::Block);
+
+ for (const Stmt *Shared : S->getSharedStmts()) {
+ if (!this->visitDeclStmt(cast<DeclStmt>(Shared), true))
+ return false;
+ }
----------------
Sirraide wrote:
Sure, `preamble` is a good idea
https://github.com/llvm/llvm-project/pull/169686
More information about the llvm-branch-commits
mailing list