Skip to content

Commit 6a74231

Browse files
authored
[SYCL] Fix tests that check capture of bindings (#16513)
A recent community change: 70965ef [Clang] Prevent assignment to captured structured bindings inside immutable lambda issues diagnostics for a construct used inside these tests. The assignments within the lambda are not central to the test, so this change just removes those.
1 parent f6f5d7c commit 6a74231

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

clang/test/CodeGenSYCL/kernel_binding_decls.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void foo() {
1212
float b[3] = { 0, 3.0f, 4.0 };
1313
} s;
1414
auto [f1, f2, f3] = s.b;
15-
auto Lambda = [=]() { x = 10; f2 = 2.3f; };
15+
auto Lambda = [=]() { (void)x; (void)f2; };
1616
h.single_task(Lambda);
1717
}
1818

@@ -51,11 +51,9 @@ void foo() {
5151
// CHECK: store ptr addrspace(4) %this, ptr addrspace(4) %this.addr.ascast
5252
// CHECK: %this1 = load ptr addrspace(4), ptr addrspace(4) %this.addr.ascast
5353

54-
// Check the store of 10 into the int value
54+
// Check the fetch of the x binding.
5555
// CHECK: %x = getelementptr inbounds nuw %class.anon, ptr addrspace(4) %this1, i32 0, i32 0
56-
// CHECK: store i32 10, ptr addrspace(4) %x
5756

58-
// Check the store of 2.3f into the float value
57+
// Check the fetch of the f2 binding.
5958
// CHECK: %f2 = getelementptr inbounds nuw %class.anon, ptr addrspace(4) %this1, i32 0, i32 1
60-
// CHECK: store float 0x4002666660000000, ptr addrspace(4) %f2
6159
// CHECK: ret void

clang/test/SemaSYCL/binding_decl_lambda_nullptr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
void foo() {
1414
int a[2] = {1, 2};
1515
auto [bind_x, bind_y] = a;
16-
auto Lambda = [=]() { bind_x = 10; };
16+
auto Lambda = [=]() { (void)bind_x; };
1717
sycl::handler h;
1818
h.single_task<class C>(Lambda);
1919
}

0 commit comments

Comments
 (0)