Skip to content

Commit 78e6da1

Browse files
committed
[OpenCL] No need to check array of struct for kernel arguments
Since arrays decay into pointers, no need to check them for arguments. This commit reverts part of the changes from the commit "[OpenCL] Check for invalid kernel arguments in array types" 3b238ed.
1 parent e16e068 commit 78e6da1

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9717,14 +9717,10 @@ static void checkIsValidOpenCLKernelParameter(
97179717
SmallVector<const FieldDecl *, 4> HistoryStack;
97189718
HistoryStack.push_back(nullptr);
97199719

9720-
// At this point we already handled everything except of a RecordType or
9721-
// an ArrayType of a RecordType.
9722-
assert((PT->isArrayType() || PT->isRecordType()) && "Unexpected type.");
9723-
const RecordType *RecTy =
9724-
PT->getPointeeOrArrayElementType()->getAs<RecordType>();
9725-
const RecordDecl *OrigRecDecl = RecTy->getDecl();
9726-
9727-
VisitStack.push_back(RecTy->getDecl());
9720+
// At this point we already handled everything except of a RecordType.
9721+
assert(PT->isRecordType() && "Unexpected type.");
9722+
const RecordDecl *PD = PT->castAs<RecordType>()->getDecl();
9723+
VisitStack.push_back(PD);
97289724
assert(VisitStack.back() && "First decl null?");
97299725

97309726
do {
@@ -9789,8 +9785,8 @@ static void checkIsValidOpenCLKernelParameter(
97899785
S.Diag(Param->getLocation(), diag::err_bad_kernel_param_type) << PT;
97909786
}
97919787

9792-
S.Diag(OrigRecDecl->getLocation(), diag::note_within_field_of_type)
9793-
<< OrigRecDecl->getDeclName();
9788+
S.Diag(PD->getLocation(), diag::note_within_field_of_type)
9789+
<< PD->getDeclName();
97949790

97959791
// We have an error, now let's go back up through history and show where
97969792
// the offending field came from

0 commit comments

Comments
 (0)