Discovered in our downstream, this function that is used to get the type
of the kernel parameter type needs to be unqualified, otherwise when our
downstream uses this function in a slightly different way, the kernel
types no longer match.
// this was passed by value, and in SYCL2020, it is passed by reference.
static QualType GetSYCLKernelObjectType(const FunctionDecl *KernelCaller) {
assert(KernelCaller->getNumParams() > 0 && "Insufficient kernel parameters");
+ // SYCL 1.2.1
QualType KernelParamTy = KernelCaller->getParamDecl(0)->getType();
// SYCL 2020 kernels are passed by reference.
if (KernelParamTy->isReferenceType())
- return KernelParamTy->getPointeeType();
+ KernelParamTy = KernelParamTy->getPointeeType();
- // SYCL 1.2.1
- return KernelParamTy;
+ return KernelParamTy.getUnqualifiedType();
}
void Sema::AddSYCLKernelLambda(const FunctionDecl *FD) {