Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[OpenCL] No need to check array of struct for kernel arguments #138894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[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.
  • Loading branch information
jiefwo committed May 7, 2025
commit 78e6da1b9f49e23afe77878b81a0aafde8108976
16 changes: 6 additions & 10 deletions 16 clang/lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9717,14 +9717,10 @@ static void checkIsValidOpenCLKernelParameter(
SmallVector<const FieldDecl *, 4> HistoryStack;
HistoryStack.push_back(nullptr);

// At this point we already handled everything except of a RecordType or
// an ArrayType of a RecordType.
assert((PT->isArrayType() || PT->isRecordType()) && "Unexpected type.");
const RecordType *RecTy =
PT->getPointeeOrArrayElementType()->getAs<RecordType>();
const RecordDecl *OrigRecDecl = RecTy->getDecl();

VisitStack.push_back(RecTy->getDecl());
// At this point we already handled everything except of a RecordType.
assert(PT->isRecordType() && "Unexpected type.");
const RecordDecl *PD = PT->castAs<RecordType>()->getDecl();
VisitStack.push_back(PD);
assert(VisitStack.back() && "First decl null?");

do {
Expand Down Expand Up @@ -9789,8 +9785,8 @@ static void checkIsValidOpenCLKernelParameter(
S.Diag(Param->getLocation(), diag::err_bad_kernel_param_type) << PT;
}

S.Diag(OrigRecDecl->getLocation(), diag::note_within_field_of_type)
<< OrigRecDecl->getDeclName();
S.Diag(PD->getLocation(), diag::note_within_field_of_type)
<< PD->getDeclName();

// We have an error, now let's go back up through history and show where
// the offending field came from
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.