Skip to content

Commit 20f3068

Browse files
authored
[SYCL][NFC] Use isZeroSizedArray from the upstream (#5317)
1 parent 34d64cf commit 20f3068

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,9 @@ bool Sema::isKnownGoodSYCLDecl(const Decl *D) {
419419
return false;
420420
}
421421

422-
static bool isZeroSizedArray(QualType Ty) {
423-
if (const auto *CATy = dyn_cast<ConstantArrayType>(Ty))
424-
return CATy->getSize() == 0;
422+
static bool isZeroSizedArray(Sema &SemaRef, QualType Ty) {
423+
if (const auto *CAT = SemaRef.getASTContext().getAsConstantArrayType(Ty))
424+
return CAT->getSize() == 0;
425425
return false;
426426
}
427427

@@ -443,7 +443,7 @@ static void checkSYCLType(Sema &S, QualType Ty, SourceRange Loc,
443443
//--- check types ---
444444

445445
// zero length arrays
446-
if (isZeroSizedArray(Ty)) {
446+
if (isZeroSizedArray(S, Ty)) {
447447
S.SYCLDiagIfDeviceCode(Loc.getBegin(), diag::err_typecheck_zero_array_size)
448448
<< 1;
449449
Emitting = true;
@@ -4042,12 +4042,6 @@ bool Sema::checkSYCLDeviceFunction(SourceLocation Loc, FunctionDecl *Callee) {
40424042
DiagKind != SemaDiagnosticBuilder::K_ImmediateWithCallStack;
40434043
}
40444044

4045-
static bool isZeroSizedArray(Sema &SemaRef, QualType Ty) {
4046-
if (const auto *CAT = SemaRef.getASTContext().getAsConstantArrayType(Ty))
4047-
return CAT->getSize() == 0;
4048-
return false;
4049-
}
4050-
40514045
void Sema::deepTypeCheckForSYCLDevice(SourceLocation UsedAt,
40524046
llvm::DenseSet<QualType> Visited,
40534047
ValueDecl *DeclToCheck) {

0 commit comments

Comments
 (0)