[clang] [clang][SYCL] Add sycl_external attribute and restrict emitting device code (PR #140282)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 25 09:34:46 PDT 2025
================
@@ -12251,6 +12264,9 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
if (NewFD->hasAttr<SYCLKernelEntryPointAttr>())
SYCL().CheckSYCLEntryPointFunctionDecl(NewFD);
+ if (NewFD->hasAttr<SYCLExternalAttr>())
+ SYCL().CheckSYCLExternalFunctionDecl(NewFD);
----------------
schittir wrote:
```
namespace { struct S9 {}; }
struct T9 {
using type = S9;
};
template<typename>
[[clang::sycl_external]] void func9() {} // error here : {{'sycl_external' can only be applied to functions with external linkage}}
template<typename T>
[[clang::sycl_external]] void test_func9() {
func9<typename T::type>(); // note here: {{in instantiation of function template specialization 'func9<(anonymous namespace)::S9>' requested here}}
}
template void test_func9<T9>(); // note here: {{in instantiation of function template specialization 'test_func9<T9>' requested here}}
```
This case is being diagnosed at present. Will fix it.
https://github.com/llvm/llvm-project/pull/140282
More information about the cfe-commits
mailing list