================ @@ -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:
Your suggested change would not be correct because it would result in declarations with `AliasAttr` or `UsedAttr` being emitted during device compilation. We could special case that check of course, but I don't think adding additional checks or special cases makes the code easier to reason about. However, I think I have convinced myself that the existing check for `SYCLKernelEntryPointAttr` and the new check for `SYCLExternalAttr` should be done before the "Forward declarations aren't required" check since extern inline functions shouldn't be emitted for device compilation unless used. 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