[clang] [clang][SYCL Upstreaming] Add sycl_external attribute and restrict emitting device code (PR #140282)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 10 10:26:38 PDT 2025


================
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+
+// Semantic tests for sycl_external attribute
+
+[[clang::sycl_external(3)]] // expected-error {{'sycl_external' attribute takes no arguments}}
+void bar() {}
+
+[[clang::sycl_external]] // expected-error {{'sycl_external' can only be applied to functions with external linkage}}
----------------
Fznamznon wrote:

The AttrDocs.td should probably mention that the attribute only applies to external functions.

https://github.com/llvm/llvm-project/pull/140282


More information about the cfe-commits mailing list