[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 14 06:50:41 PDT 2025
================
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify %s
+
+// expected-error at +1{{'clang::sycl_external' attribute only applies to functions}}
+[[clang::sycl_external]] int a;
+
+
+// expected-error at +2{{'clang::sycl_external' attribute only applies to functions}}
+struct s {
+[[clang::sycl_external]] int b;
+};
+
+// expected-error at +1{{'clang::sycl_external' attribute takes no arguments}}
+[[clang::sycl_external(3)]] void bar() {}
+
+// FIXME: The first declaration of a function is required to have the attribute.
+// The attribute may be optionally present on subsequent declarations
+int foo(int c);
+
+[[clang::sycl_external]] void foo();
----------------
schittir wrote:
Thank you for your observations. This was a mistake - I planned to move these tests to the appropriate places like you suggested, but clearly, I overlooked it.
https://github.com/llvm/llvm-project/pull/140282
More information about the cfe-commits
mailing list