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

That is intentional and consistent with what DPC++ does for its `sycl_device` 
attribute; see 
https://github.com/intel/llvm/blob/a70552b59fd4f91b2d80d755aedcd9e93ae61ee1/clang/lib/AST/ASTContext.cpp#L13068-L13070.
 For example, global variables shouldn't be emitted in device code.

It might be worth adding a comment that explains this though.

https://github.com/llvm/llvm-project/pull/140282
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to