| 1 |
// Test that SYCL kernel name conflicts that occur across PCH boundaries are |
| 2 |
// properly diagnosed. |
| 3 |
|
| 4 |
// RUN: rm -rf %t |
| 5 |
// RUN: split-file %s %t |
| 6 |
// RUN: %clang_cc1 -std=c++17 -fsycl-is-host -emit-pch -x c++-header \ |
| 7 |
// RUN: %t/pch.h -o %t/pch.h.host.pch |
| 8 |
// RUN: %clang_cc1 -std=c++17 -fsycl-is-host -verify \ |
| 9 |
// RUN: -include-pch %t/pch.h.host.pch %t/test.cpp |
| 10 |
// RUN: %clang_cc1 -std=c++17 -fsycl-is-device -emit-pch -x c++-header \ |
| 11 |
// RUN: %t/pch.h -o %t/pch.h.device.pch |
| 12 |
// RUN: %clang_cc1 -std=c++17 -fsycl-is-device -verify \ |
| 13 |
// RUN: -include-pch %t/pch.h.device.pch %t/test.cpp |
| 14 |
|
| 15 |
#--- pch.h |
| 16 |
template<int> struct KN; |
| 17 |
|
| 18 |
[[clang::sycl_kernel_entry_point(KN<1>)]] |
| 19 |
void pch_test1() {} // << expected previous declaration note here. |
| 20 |
|
| 21 |
template<typename T> |
| 22 |
[[clang::sycl_kernel_entry_point(T)]] |
| 23 |
void pch_test2() {} // << expected previous declaration note here. |
| 24 |
template void pch_test2<KN<2>>(); |
| 25 |
|
| 26 |
|
| 27 |
#--- test.cpp |
| 28 |
// expected-error@+3 {{the 'clang::sycl_kernel_entry_point' kernel name argument conflicts with a previous declaration}} |
| 29 |
// [email protected]:4 {{previous declaration is here}} |
| 30 |
[[clang::sycl_kernel_entry_point(KN<1>)]] |
| 31 |
void test1() {} |
| 32 |
|
| 33 |
// expected-error@+3 {{the 'clang::sycl_kernel_entry_point' kernel name argument conflicts with a previous declaration}} |
| 34 |
// [email protected]:8 {{previous declaration is here}} |
| 35 |
[[clang::sycl_kernel_entry_point(KN<2>)]] |
| 36 |
void test2() {} |