@@ -6485,17 +6485,31 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) {
64856485 Policy.FullyQualifiedName = true ;
64866486 Policy.EnforceScopeForElaboratedTypes = true ;
64876487
6488+ // Now we need to print the declaration of the kernel itself.
6489+ // Example:
6490+ // template <typename T, typename = int> struct Arg {
6491+ // T val;
6492+ // };
6493+ // For the following free function kernel:
6494+ // template <typename = T>
6495+ // SYCL_EXT_ONEAPI_FUNCTION_PROPERTY(
6496+ // (ext::oneapi::experimental::nd_range_kernel<1>))
6497+ // void foo(Arg<int> arg) {}
6498+ // Integration header must contain the following declaration:
6499+ // template <typename>
6500+ // void foo(Arg<int, int> arg);
64886501 // SuppressDefaultTemplateArguments is a downstream addition that suppresses
6489- // default template arguments in function declarations. It should be set to
6490- // true to emit function declaration that won't cause any compilation errors
6491- // when present in the integration header.
6492- // SuppressDefaultTemplateArgs is a flag from community code which adds
6493- // suppression of template arguments that match default template arguments
6494- // in template-ids printing.
6502+ // default template arguments in the function declaration. It should be set
6503+ // to true to emit function declaration that won't cause any compilation
6504+ // errors when present in the integration header.
6505+ // To print Arg<int, int> in the function declaration and shim functions we
6506+ // need to disable default arguments printing suppression via community flag
6507+ // SuppressDefaultTemplateArgs, otherwise they will be suppressed even for
6508+ // canonical types or if even written in the original source code.
64956509 Policy.SuppressDefaultTemplateArguments = true ;
64966510 // EnforceDefaultTemplateArgs is a downstream addition that forces printing
64976511 // template arguments that match default template arguments while printing
6498- // template-ids, even if the source code doesn't referece them.
6512+ // template-ids, even if the source code doesn't reference them.
64996513 Policy.EnforceDefaultTemplateArgs = true ;
65006514 if (FTD) {
65016515 FTD->print (O, Policy);
0 commit comments