================
@@ -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>())
----------------
erichkeane wrote:

Hmmm... this skips quite a bit which causes obvious discomfort.  

There's quite a bit inside of the function itself that get skipped too, which 
is a little concerning, particularly with us all-over-the-place.

IMO, I think a better formulation for the purposes of readability of this would 
to better integrate these in this function.

~12956 (though perhaps higher than 12950?):
```
// Some comment about how other attributes/etc are all irrelevant for the 
purposes of SYCL.
if (LangOpts.SYCLIsDevice) 
      return FD->hasAttr<SYCLKernelEntryPointAttr>() || 
FD->hasAttr<SYCLExternalAttr>();
```

Then around 12990:
```
// Some comment about how global variables should never be emitted
if(LangOpts.SYCLIsDevice) return false;
```

That way this requires MUCH less tea-leaf reading of the rest of the function 
to figure out when/why we're excluding these.

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