[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,16 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+
+// expected-warning at +1{{'sycl_external' attribute only applies to functions}}
+[[clang::sycl_external]] int a;
+
+
+// expected-warning at +2{{'sycl_external' attribute only applies to functions}}
+struct s {
+[[clang::sycl_external]] int b;
+};
+
+// FIXME: The first declaration of a function is required to have the attribute.
----------------
Fznamznon wrote:

Why?

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


More information about the cfe-commits mailing list