llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Jiefeng Wang (jiefwo) <details> <summary>Changes</summary> 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" 3b238ed6626983beb238b95eada4172184fb2d29. --- Full diff: https://github.com/llvm/llvm-project/pull/138894.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaDecl.cpp (+6-10) ``````````diff diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 6b561d7bfc6e7..364fb064ccc2d 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -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 { @@ -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 `````````` </details> https://github.com/llvm/llvm-project/pull/138894 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits