Skip to content

Commit 62e2f3b

Browse files
author
Erich Keane
authored
[SYCL] Ensure Int-header prints CVR qualifiers for class template params (#1932)
The integration header code seems to skip CVR qualifiers in at least this one branch, so it makes the type unusable in the host build. This patch ensures that the qualifiers get printed.
1 parent 616a396 commit 62e2f3b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

clang/lib/Sema/SemaSYCL.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -2208,6 +2208,10 @@ static std::string getKernelNameTypeString(QualType T, ASTContext &Ctx,
22082208
SmallString<64> Buf;
22092209
llvm::raw_svector_ostream ArgOS(Buf);
22102210

2211+
// Print the qualifiers for the type.
2212+
FullyQualifiedType.getQualifiers().print(ArgOS, TypePolicy,
2213+
/*appendSpaceIfNotEmpty*/ true);
2214+
22112215
// Print template class name
22122216
TSD->printQualifiedName(ArgOS, TypePolicy, /*WithGlobalNsPrefix*/ true);
22132217

clang/test/CodeGenSYCL/int_header1.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// CHECK:template <> struct KernelInfo<::nm1::KernelName8<::nm1::nm2::C>> {
1414
// CHECK:template <> struct KernelInfo<::TmplClassInAnonNS<ClassInAnonNS>> {
1515
// CHECK:template <> struct KernelInfo<::nm1::KernelName9<char>> {
16+
// CHECK:template <> struct KernelInfo<::nm1::KernelName3<const volatile ::nm1::KernelName3<const volatile char>>> {
1617

1718
// This test checks if the SYCL device compiler is able to generate correct
1819
// integration header when the kernel name class is expressed in different
@@ -136,6 +137,12 @@ struct MyWrapper {
136137
kernel_single_task<nm1::KernelName9<char>>(
137138
[=]() { acc.use(); });
138139

140+
// Ensure we print template arguments with CVR qualifiers
141+
kernel_single_task<nm1::KernelName3<
142+
const volatile nm1::KernelName3<
143+
const volatile char>>>(
144+
[=]() { acc.use(); });
145+
139146
return 0;
140147
}
141148
};

0 commit comments

Comments
 (0)