[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
================
@@ -202,6 +202,17 @@ void SemaSYCL::handleKernelAttr(Decl *D, const ParsedAttr &AL) {
handleSimpleAttribute<DeviceKernelAttr>(*this, D, AL);
}
+void SemaSYCL::handleExternalAttr(Decl *D, const ParsedAttr &AL) {
+ auto *ND = cast<NamedDecl>(D);
+ if (!ND->isExternallyVisible()) {
+ Diag(AL.getLoc(), diag::err_sycl_attribute_invalid_linkage)
+ << AL << !isa<FunctionDecl>(ND);
----------------
tahonermann wrote:
The error diagnostic doesn't specify replacement fields, so the redirection arguments aren't needed.
```suggestion
Diag(AL.getLoc(), diag::err_sycl_attribute_invalid_linkage);
```
https://github.com/llvm/llvm-project/pull/140282
More information about the cfe-commits
mailing list