
This patch is part of the upstreaming effort for supporting SYCL language front end. It makes the following changes: 1. Adds sycl_external attribute for functions with external linkage, which is intended for use to implement the SYCL_EXTERNAL macro as specified by the SYCL 2020 specification 2. Adds checks to avoid emitting device code when sycl_external and sycl_kernel_entry_point attributes are not enabled 3. Fixes test failures caused by the above changes This patch is missing diagnostics for the following diagnostics listed in the SYCL 2020 specification's section 5.10.1, which will be addressed in a subsequent PR: Functions that are declared using SYCL_EXTERNAL have the following additional restrictions beyond those imposed on other device functions: 1. If the SYCL backend does not support the generic address space then the function cannot use raw pointers as parameter or return types. Explicit pointer classes must be used instead; 2. The function cannot call group::parallel_for_work_item; 3. The function cannot be called from a parallel_for_work_group scope. In addition to that, the subsequent PR will also implement diagnostics for inline functions including virtual functions defined as inline. --------- Co-authored-by: Mariya Podchishchaeva <mariya.podchishchaeva@intel.com>
37 lines
1.4 KiB
C++
37 lines
1.4 KiB
C++
// RUN: %clang_cc1 -fsycl-is-host -fsyntax-only -std=c++17 -verify %s
|
|
// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -std=c++17 -verify %s
|
|
// RUN: %clang_cc1 -fsycl-is-host -fsyntax-only -std=c++20 -verify %s
|
|
// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -std=c++20 -verify %s
|
|
// RUN: %clang_cc1 -fsycl-is-host -fsyntax-only -std=c++23 -verify %s
|
|
// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -std=c++23 -verify %s
|
|
|
|
// expected-error@+1{{'clang::sycl_external' attribute only applies to functions}}
|
|
[[clang::sycl_external]] int bad1;
|
|
|
|
|
|
// expected-error@+2{{'clang::sycl_external' attribute only applies to functions}}
|
|
struct s {
|
|
[[clang::sycl_external]] int bad2;
|
|
};
|
|
|
|
// expected-error@+1{{'clang::sycl_external' attribute only applies to functions}}
|
|
namespace [[clang::sycl_external]] bad3 {}
|
|
|
|
// expected-error@+1{{'clang::sycl_external' attribute only applies to functions}}
|
|
struct [[clang::sycl_external]] bad4;
|
|
|
|
// expected-error@+1{{'clang::sycl_external' attribute only applies to functions}}
|
|
enum [[clang::sycl_external]] bad5 {};
|
|
|
|
// expected-error@+1{{'clang::sycl_external' attribute only applies to functions}}
|
|
int bad6(void (fp [[clang::sycl_external]])());
|
|
|
|
// expected-error@+1{{'clang::sycl_external' attribute only applies to functions}}
|
|
[[clang::sycl_external]];
|
|
|
|
#if __cplusplus >= 202002L
|
|
// expected-error@+2{{'clang::sycl_external' attribute only applies to functions}}
|
|
template<typename>
|
|
concept bad8 [[clang::sycl_external]] = true;
|
|
#endif
|