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

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 16 07:01:07 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;
+};
----------------
tahonermann wrote:

Per my comment on the definition of the attribute, I think these should be errors.

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


More information about the cfe-commits mailing list