[clang] Add sycl_external attribute (PR #140282)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Fri May 16 20:45:25 PDT 2025


================
@@ -12909,6 +12909,9 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
   if (D->hasAttr<WeakRefAttr>())
     return false;
 
+  if (LangOpts.SYCLIsDevice && !D->hasAttr<SYCLKernelEntryPointAttr>())
+    return false;
----------------
tahonermann wrote:

This will also need to check for the new `SYCLExternalAttr` attribute for the new code below to be reachable (I neglected to add this condition in the example I gave you elsewhere).
```suggestion
  if (LangOpts.SYCLIsDevice && !D->hasAttr<SYCLKernelEntryPointAttr>() &&
      !D->hasAttr<SYCLExternalAttr>())
    return false;
```

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


More information about the cfe-commits mailing list