[clang] [CIR] Upstream support for range-based for loops (PR #138176)

2025-05-01 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/138176 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for range-based for loops (PR #138176)

2025-05-01 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/138176 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for range-based for loops (PR #138176)

2025-05-01 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/138176 Rate limit ยท GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,san

[clang] [CIR] Upstream support for range-based for loops (PR #138176)

2025-05-01 Thread Andy Kaylor via cfe-commits
@@ -190,6 +190,117 @@ void l3() { // OGCG: store i32 0, ptr %[[I]], align 4 // OGCG: br label %[[FOR_COND]] +void l4() { + int a[10]; + for (int n : a) andykaylor wrote: No, I don't think iterators will work yet. https://github.com/llvm/llvm-project/pu

[clang] [CIR] Upstream support for range-based for loops (PR #138176)

2025-05-01 Thread Andy Kaylor via cfe-commits
@@ -190,6 +190,117 @@ void l3() { // OGCG: store i32 0, ptr %[[I]], align 4 // OGCG: br label %[[FOR_COND]] +void l4() { + int a[10]; + for (int n : a) +; +} + +// CIR: cir.func @_Z2l4v +// CIR: %[[A_ADDR:.*]] = cir.alloca !cir.array, !cir.ptr>, ["a"] {alignment =

[clang] [CIR] Upstream support for range-based for loops (PR #138176)

2025-05-01 Thread Erich Keane via cfe-commits
@@ -547,6 +548,83 @@ mlir::LogicalResult CIRGenFunction::emitSwitchCase(const SwitchCase &s, llvm_unreachable("expect case or default stmt"); } +mlir::LogicalResult +CIRGenFunction::emitCXXForRangeStmt(const CXXForRangeStmt &s, +ArrayRef

[clang] [CIR] Upstream support for range-based for loops (PR #138176)

2025-05-01 Thread Erich Keane via cfe-commits
@@ -190,6 +190,117 @@ void l3() { // OGCG: store i32 0, ptr %[[I]], align 4 // OGCG: br label %[[FOR_COND]] +void l4() { + int a[10]; + for (int n : a) erichkeane wrote: Can we do a test with a type with `begin` and `end` as well? Or cant we support g

[clang] [CIR] Upstream support for range-based for loops (PR #138176)

2025-05-01 Thread Erich Keane via cfe-commits
@@ -190,6 +190,117 @@ void l3() { // OGCG: store i32 0, ptr %[[I]], align 4 // OGCG: br label %[[FOR_COND]] +void l4() { + int a[10]; + for (int n : a) +; +} + +// CIR: cir.func @_Z2l4v +// CIR: %[[A_ADDR:.*]] = cir.alloca !cir.array, !cir.ptr>, ["a"] {alignment =

[clang] [CIR] Upstream support for range-based for loops (PR #138176)

2025-05-01 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Andy Kaylor (andykaylor) Changes This upstreams the code needed to handle CXXForRangeStmt. --- Full diff: https://github.com/llvm/llvm-project/pull/138176.diff 5 Files Affected: - (modified) clang/lib/CIR/CodeGen/CIRGenExpr.cpp (+35) -

[clang] [CIR] Upstream support for range-based for loops (PR #138176)

2025-05-01 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clangir Author: Andy Kaylor (andykaylor) Changes This upstreams the code needed to handle CXXForRangeStmt. --- Full diff: https://github.com/llvm/llvm-project/pull/138176.diff 5 Files Affected: - (modified) clang/lib/CIR/CodeGen/CIRGenExpr.cpp (+35)

[clang] [CIR] Upstream support for range-based for loops (PR #138176)

2025-05-01 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/138176 This upstreams the code needed to handle CXXForRangeStmt. >From 7d5d27ea5d2afbb70c3aae958a6f87d94e826aae Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 30 Apr 2025 09:59:15 -0700 Subject: [PATCH] [CIR