https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/186816
Instead of the iteration scope. >From 89419f3a64f6d79966bd7d79ddaa4ad1a62d81a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]> Date: Mon, 16 Mar 2026 15:50:55 +0100 Subject: [PATCH] asdf --- clang/lib/AST/ByteCode/Compiler.cpp | 9 +++++---- clang/test/AST/ByteCode/loops.cpp | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index 8bbdf284b313d..de0465c8b33a6 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -6112,15 +6112,16 @@ bool Compiler<Emitter>::visitWhileStmt(const WhileStmt *S) { LocalScope<Emitter> WholeLoopScope(this); LoopScope<Emitter> LS(this, S, EndLabel, CondLabel); + if (const DeclStmt *CondDecl = S->getConditionVariableDeclStmt()) { + if (!visitDeclStmt(CondDecl)) + return false; + } + this->fallthrough(CondLabel); this->emitLabel(CondLabel); { LocalScope<Emitter> CondScope(this); - if (const DeclStmt *CondDecl = S->getConditionVariableDeclStmt()) - if (!visitDeclStmt(CondDecl)) - return false; - if (!this->visitBool(Cond)) return false; diff --git a/clang/test/AST/ByteCode/loops.cpp b/clang/test/AST/ByteCode/loops.cpp index 38ab5613e1cbd..ff80ef5c6e2ed 100644 --- a/clang/test/AST/ByteCode/loops.cpp +++ b/clang/test/AST/ByteCode/loops.cpp @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -std=c++14 -verify %s -// RUN: %clang_cc1 -std=c++14 -verify=ref %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -std=c++14 -verify %s +// RUN: %clang_cc1 -std=c++14 -verify=ref %s // RUN: %clang_cc1 -fexperimental-new-constant-interpreter -std=c++20 -verify=expected-cpp20 %s -// RUN: %clang_cc1 -std=c++20 -verify=ref %s +// RUN: %clang_cc1 -std=c++20 -verify=ref %s namespace WhileLoop { constexpr int f() { @@ -351,4 +351,14 @@ namespace Scopes { return n; } static_assert(foo() == 14, ""); + + constexpr bool WhileConditionDecl() { + bool b = true; + for (int i = 0; i < 3; ++i) { + while (int x = 0) { + } + } + return true; + } + static_assert(WhileConditionDecl(), ""); } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
