[clang] [clang][CFG] Fix range-for iterator initialization order (PR #234467)

Benedek Kaibas via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 12:51:38 PDT 2026


================
@@ -4989,8 +4989,8 @@ CFGBlock *CFGBuilder::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
 
   // Add the initialization statements.
   Block = createBlock();
-  addStmt(S->getBeginStmt());
   addStmt(S->getEndStmt());
+  addStmt(S->getBeginStmt());
----------------
benedekaibas wrote:

> I doubt anything was discussed in relation to this, but you made me curious so I'll try to dig this up.

Sounds great, thank you!

https://github.com/llvm/llvm-project/pull/234467


More information about the cfe-commits mailing list