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

An additional thought after clicking 'start-review':  Perhaps something like:

```
// Comment explaining that on a sycl device, the ONLY thing we emit is 
functions (not variables), and ONLY those that have one of these two attributes.
if (LangOpts.SYCLIsDevice)
return isa<FunctionDecl>(D) && (D->hasAttr<...>() || D->hasAttr<....>());
```

I'm realizing as I look through this more, part of my problem is the vascus 
relationship between this section, the fact that these two attributes are only 
legal on a function decl, and the part on line 12948.  So there are three 
sizable parts of logic scattered around the program that makes this REALLY 
awful to figure out.

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