Skip to content

Commit 835cef0

Browse files
Add null check for TemplateArg Visitor
1 parent 8ba5dbb commit 835cef0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2507,7 +2507,12 @@ class SYCLKernelNameTypeVisitor
25072507
}
25082508
}
25092509

2510-
void Visit(const TemplateArgument &TA) { InnerTAVisitor::Visit(TA); }
2510+
void Visit(const TemplateArgument &TA) {
2511+
if (TA.isNull())
2512+
return;
2513+
else
2514+
InnerTAVisitor::Visit(TA);
2515+
}
25112516

25122517
void VisitEnumType(const EnumType *T) {
25132518
const EnumDecl *ED = T->getDecl();
@@ -2620,6 +2625,7 @@ void Sema::CheckSYCLKernelCall(FunctionDecl *KernelFunc, SourceRange CallLoc,
26202625

26212626
KernelObjVisitor Visitor{*this};
26222627
SYCLKernelNameTypeVisitor KernelTypeVisitor(*this, Args[0]->getExprLoc());
2628+
// Emit diagnostics for SYCL device kernels only
26232629
if (LangOpts.SYCLIsDevice)
26242630
KernelTypeVisitor.Visit(KernelNameType);
26252631
DiagnosingSYCLKernel = true;

0 commit comments

Comments
 (0)