================
@@ -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:

I mentioned global variables are just one example; we don't want to emit 
anything that follows the current point of check unless it is explicitly used. 
I understand the concern, but I think the code is right as is. I suggest we 
stay with the currently proposed change for now and revisit how to handle this 
better if a need for more fine-grained selections emerges. Note that DPC++ 
hasn't demonstrated such a need so far.

I do think adding a comment would be helpful 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