================
@@ -16227,6 +16227,32 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope
*FnBodyScope, Decl *D,
maybeAddDeclWithEffects(FD);
+ if (FD && !FD->isInvalidDecl() && FD->hasAttr<SYCLKernelEntryPointAttr>() &&
+ FnBodyScope) {
+ // An implicit call expression is synthesized for functions declared with
+ // the sycl_kernel_entry_point attribute. The call may resolve to a
+ // function template, a member function template, or a call operator
+ // of a variable template depending on the results of unqualified lookup
+ // for 'sycl_kernel_launch' from the beginning of the function body.
+ // Performing that lookup requires the stack of parsing scopes active
+ // when the definition is parsed and is thus done here; the result is
+ // cached in FunctionScopeInfo and used to synthesize the (possibly
+ // unresolved) call expression after the function body has been parsed.
+ const auto *SKEPAttr = FD->getAttr<SYCLKernelEntryPointAttr>();
+ if (!SKEPAttr->isInvalidAttr()) {
+ ExprResult LaunchIdExpr =
+ SYCL().BuildSYCLKernelLaunchIdExpr(FD, SKEPAttr->getKernelName());
+ if (LaunchIdExpr.isInvalid()) {
+ // Do not mark 'FD' as invalid. Name lookup failure for
+ // 'sycl_kernel_launch' is treated as an error in the definition of
+ // 'FD'; treating it as an error of the declaration would affect
+ // overload resolution.
+ }
----------------
Fznamznon wrote:
An if with comment-only body is strange IMO. Can we simply leave the comment?
https://github.com/llvm/llvm-project/pull/152403
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits