diff --git a/clang/lib/Sema/SemaSYCL.cpp b/clang/lib/Sema/SemaSYCL.cpp index 32a528c29008e..f0458b5c020fb 100644 --- a/clang/lib/Sema/SemaSYCL.cpp +++ b/clang/lib/Sema/SemaSYCL.cpp @@ -11,6 +11,7 @@ #include "TreeTransform.h" #include "clang/AST/AST.h" +#include "clang/AST/QualTypeNames.h" #include "clang/AST/RecordLayout.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/Sema/Sema.h" @@ -705,7 +706,10 @@ void Sema::ConstructSYCLKernel(FunctionDecl *KernelCallerFunc) { // Get Name for our kernel. const TemplateArgumentList *TemplateArgs = KernelCallerFunc->getTemplateSpecializationArgs(); - QualType KernelNameType = TemplateArgs->get(0).getAsType(); + QualType KernelNameType = TypeName::getFullyQualifiedType( + TemplateArgs->get(0).getAsType(), + getASTContext(), + true); std::string Name = constructKernelName(KernelNameType); populateIntHeader(getSyclIntegrationHeader(), Name, KernelNameType, LE); diff --git a/clang/test/CodeGenSYCL/integration_header.cpp b/clang/test/CodeGenSYCL/integration_header.cpp index 970b45ea59842..357fa08151567 100644 --- a/clang/test/CodeGenSYCL/integration_header.cpp +++ b/clang/test/CodeGenSYCL/integration_header.cpp @@ -14,8 +14,8 @@ // CHECK: static constexpr // CHECK-NEXT: const char* const kernel_names[] = { // CHECK-NEXT: "first_kernel", -// CHECK-NEXT: "second_namespace::second_kernel", -// CHECK-NEXT: "third_kernel<1, int, point< X> >" +// CHECK-NEXT: "::second_namespace::second_kernel", +// CHECK-NEXT: "::third_kernel<1, int, ::point >" // CHECK-NEXT: }; // // CHECK: static constexpr @@ -27,12 +27,12 @@ // CHECK-NEXT: { kernel_param_kind_t::kind_accessor, 2016, 5 }, // CHECK-NEXT: { kernel_param_kind_t::kind_scalar, 1, 5 }, // CHECK-EMPTY: -// CHECK-NEXT: //--- second_namespace::second_kernel +// CHECK-NEXT: //--- ::second_namespace::second_kernel // CHECK-NEXT: { kernel_param_kind_t::kind_scalar, 4, 0 }, // CHECK-NEXT: { kernel_param_kind_t::kind_accessor, 2016, 4 }, // CHECK-NEXT: { kernel_param_kind_t::kind_scalar, 1, 4 }, // CHECK-EMPTY: -// CHECK-NEXT: //--- third_kernel<1, int, point< X> > +// CHECK-NEXT: //--- ::third_kernel<1, int, ::point > // CHECK-NEXT: { kernel_param_kind_t::kind_scalar, 4, 0 }, // CHECK-NEXT: { kernel_param_kind_t::kind_accessor, 2016, 4 }, // CHECK-NEXT: { kernel_param_kind_t::kind_scalar, 1, 4 }, @@ -41,8 +41,8 @@ // // CHECK: template struct KernelInfo; // CHECK: template <> struct KernelInfo { -// CHECK: template <> struct KernelInfo> { -// CHECK: template <> struct KernelInfo >> { +// CHECK: template <> struct KernelInfo<::second_namespace::second_kernel> { +// CHECK: template <> struct KernelInfo<::third_kernel<1, int, ::point >> { namespace cl { namespace sycl {