Skip to content
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
5 changes: 3 additions & 2 deletions clang/lib/AST/StmtPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1316,8 +1316,9 @@ void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
if (Node->hasTemplateKeyword())
OS << "template ";

bool ForceAnonymous =
Policy.PrintAsCanonical && VD->getKind() == Decl::NonTypeTemplateParm;
bool ForceAnonymous = Policy.PrintAsCanonical &&
!Policy.SkipCanonicalizationOfTemplateTypeParms &&
VD->getKind() == Decl::NonTypeTemplateParm;
DeclarationNameInfo NameInfo = Node->getNameInfo();
if (IdentifierInfo *ID = NameInfo.getName().getAsIdentifierInfo();
!ForceAnonymous &&
Expand Down
13 changes: 11 additions & 2 deletions clang/test/CodeGenSYCL/int_header_nttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// CHECK: Forward declarations of templated kernel function types:
// CHECK-NEXT: template <typename T, T nttp> struct SelfReferentialNTTP;
// CHECK-NEXT: template <typename U, int nttp> struct NonSelfRef;
// CHECK-NEXT: template <int N> struct alignas(N) OpaqueType;

template<typename T, T nttp>
struct SelfReferentialNTTP {};
Expand All @@ -17,7 +18,15 @@ using Foo = int;
template<typename U, Foo nttp>
struct NonSelfRef {};

template <int N> struct alignas(N) OpaqueType {
char data[N];
};
template <typename T> class Kernel;

void foo() {
sycl::kernel_single_task<SelfReferentialNTTP<int, 1>>([](){});
sycl::kernel_single_task<NonSelfRef<int, 1>>([](){});
auto Lambda = [](){};
sycl::kernel_single_task<SelfReferentialNTTP<int, 1>>(Lambda);
sycl::kernel_single_task<NonSelfRef<int, 1>>(Lambda);
using scalar_t = OpaqueType<sizeof(int)>;
sycl::kernel_single_task<class Kernel<scalar_t>>(Lambda);
}