Skip to content

Commit 4f844e7

Browse files
authored
[OpenCL] No need to check array of struct for kernel arguments (#138894)
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 2e12bad commit 4f844e7

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
@@ -9725,14 +9725,10 @@ static void checkIsValidOpenCLKernelParameter(
97259725
SmallVector<const FieldDecl *, 4> HistoryStack;
97269726
HistoryStack.push_back(nullptr);
97279727

9728-
// At this point we already handled everything except of a RecordType or
9729-
// an ArrayType of a RecordType.
9730-
assert((PT->isArrayType() || PT->isRecordType()) && "Unexpected type.");
9731-
const RecordType *RecTy =
9732-
PT->getPointeeOrArrayElementType()->getAs<RecordType>();
9733-
const RecordDecl *OrigRecDecl = RecTy->getDecl();
9734-
9735-
VisitStack.push_back(RecTy->getDecl());
9728+
// At this point we already handled everything except of a RecordType.
9729+
assert(PT->isRecordType() && "Unexpected type.");
9730+
const RecordDecl *PD = PT->castAs<RecordType>()->getDecl();
9731+
VisitStack.push_back(PD);
97369732
assert(VisitStack.back() && "First decl null?");
97379733

97389734
do {
@@ -9797,8 +9793,8 @@ static void checkIsValidOpenCLKernelParameter(
97979793
S.Diag(Param->getLocation(), diag::err_bad_kernel_param_type) << PT;
97989794
}
97999795

9800-
S.Diag(OrigRecDecl->getLocation(), diag::note_within_field_of_type)
9801-
<< OrigRecDecl->getDeclName();
9796+
S.Diag(PD->getLocation(), diag::note_within_field_of_type)
9797+
<< PD->getDeclName();
98029798

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

0 commit comments

Comments
 (0)