Skip to content

Commit af03188

Browse files
committed
[SYCL] something deprecated attr propagation
1 parent 65849fd commit af03188

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,18 +1122,14 @@ getKernelInvocationKind(FunctionDecl *KernelCallerFunc) {
11221122

11231123
// The SYCL kernel's 'object type' used for diagnostics and naming/mangling is
11241124
// the first parameter to a function template using the sycl_kernel
1125-
// attribute. In SYCL 1.2.1, this was passed by value,
1126-
// and in SYCL 2020, it is passed by reference.
1125+
// attribute. In SYCL 2020, this is passed by reference.
11271126
static QualType GetSYCLKernelObjectType(const FunctionDecl *KernelCaller) {
11281127
assert(KernelCaller->getNumParams() > 0 && "Insufficient kernel parameters");
11291128
QualType KernelParamTy = KernelCaller->getParamDecl(0)->getType();
11301129

11311130
// SYCL 2020 kernels are passed by reference.
1132-
if (KernelParamTy->isReferenceType())
1133-
KernelParamTy = KernelParamTy->getPointeeType();
1134-
1135-
// SYCL 1.2.1
1136-
return KernelParamTy.getUnqualifiedType();
1131+
assert(KernelParamTy->isReferenceType() && "Since SYCL 2020 kernels must be passed by reference.");
1132+
return KernelParamTy = KernelParamTy->getPointeeType();
11371133
}
11381134

11391135
/// \return the target of given SYCL accessor type
@@ -5038,7 +5034,7 @@ void SemaSYCL::CheckSYCLKernelCall(FunctionDecl *KernelFunc,
50385034

50395035
// check that calling kernel conforms to spec
50405036
QualType KernelParamTy = KernelFunc->getParamDecl(0)->getType();
5041-
if (not KernelParamTy->isReferenceType()) {
5037+
if (! KernelParamTy->isReferenceType()) {
50425038
// passing by value. emit warning if using SYCL 2020 or greater
50435039
if (SemaRef.LangOpts.getSYCLVersion() >= LangOptions::SYCL_2020)
50445040
Diag(KernelFunc->getLocation(), diag::warn_sycl_pass_by_value_deprecated);

0 commit comments

Comments
 (0)