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