================
@@ -0,0 +1,52 @@
+// RUN: %clang_cc1 -fsycl-is-device -fsyntax-only -verify -DSYCL %s
+// RUN: %clang_cc1 -fsycl-is-host -fsyntax-only -verify -DHOST %s
+// RUN: %clang_cc1 -verify %s
+
+// Semantic tests for sycl_external attribute
+
+#ifdef SYCL
+
+__attribute__((sycl_external(3))) // expected-error {{'sycl_external'
attribute takes no arguments}}
+void bar() {}
+
+__attribute__((sycl_external)) // expected-error {{'sycl_external' attribute
cannot be applied to a function without external linkage}}
+static void func1() {}
+
+namespace {
+ __attribute__((sycl_external)) // expected-error {{'sycl_external' attribute
cannot be applied to a function without external linkage}}
+ void func2() {}
+
+ struct UnnX {};
+}
+
+__attribute__((sycl_external)) // expected-error {{'sycl_external' attribute
cannot be applied to a function without external linkage}}
+ void func4(UnnX) {}
+
+class A {
+ __attribute__((sycl_external))
+ A() {}
+
+ __attribute__((sycl_external)) void func3() {}
+};
+
+class B {
+public:
+ __attribute__((sycl_external)) virtual void foo() {}
+
+ __attribute__((sycl_external)) virtual void bar() = 0;
+};
+
+__attribute__((sycl_external)) int *func0() { return nullptr; }
+
+__attribute__((sycl_external)) void func2(int *) {}
+
+#elif defined(HOST)
+
+// expected-no-diagnostics
+__attribute__((sycl_external)) void func3() {}
+
+#else
+__attribute__((sycl_external)) // expected-warning {{'sycl_external' attribute
ignored}}
+void baz() {}
+
+#endif
----------------
tahonermann wrote:
There are a few different concerns being exercised by this test. We have a
precedent in place for exercising appertainment, grammar, and relevance by
different test files in the `sycl-kernel-entry-point-attr-*` tests. Can we
follow that pattern (and associated naming conventions) here? I'm not so
concerned about the testing being as extensive as it is in those other tests,
but splitting these concerns will allow additional cases to be added later with
less disruption.
https://github.com/llvm/llvm-project/pull/140282
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits