Skip to content

[SYCL] Ensure Int-header prints CVR qualifiers for class template params #1932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clang/lib/Sema/SemaSYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2208,6 +2208,10 @@ static std::string getKernelNameTypeString(QualType T, ASTContext &Ctx,
SmallString<64> Buf;
llvm::raw_svector_ostream ArgOS(Buf);

// Print the qualifiers for the type.
FullyQualifiedType.getQualifiers().print(ArgOS, TypePolicy,
/*appendSpaceIfNotEmpty*/ true);

// Print template class name
TSD->printQualifiedName(ArgOS, TypePolicy, /*WithGlobalNsPrefix*/ true);

Expand Down
7 changes: 7 additions & 0 deletions clang/test/CodeGenSYCL/int_header1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// CHECK:template <> struct KernelInfo<::nm1::KernelName8<::nm1::nm2::C>> {
// CHECK:template <> struct KernelInfo<::TmplClassInAnonNS<ClassInAnonNS>> {
// CHECK:template <> struct KernelInfo<::nm1::KernelName9<char>> {
// CHECK:template <> struct KernelInfo<::nm1::KernelName3<const volatile ::nm1::KernelName3<const volatile char>>> {

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

// Ensure we print template arguments with CVR qualifiers
kernel_single_task<nm1::KernelName3<
const volatile nm1::KernelName3<
const volatile char>>>(
[=]() { acc.use(); });

return 0;
}
};
Expand Down