Skip to content

Commit ac93254

Browse files
Corrected code to work for array of streams.
Also removed unnecessary check. Signed-off-by: Elizabeth Andrews <[email protected]>
1 parent 4b15731 commit ac93254

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
@@ -1584,9 +1584,6 @@ class SyclKernelBodyCreator
15841584
}
15851585

15861586
void addStructInit(const CXXRecordDecl *RD) {
1587-
if (!RD)
1588-
return;
1589-
15901587
const ASTRecordLayout &Info =
15911588
SemaRef.getASTContext().getASTRecordLayout(RD);
15921589
int NumberOfFields = Info.getFieldCount();
@@ -1610,15 +1607,12 @@ class SyclKernelBodyCreator
16101607

16111608
QualType FieldTy = FD->getType();
16121609

1610+
const CXXRecordDecl *RD = FieldTy->getAsCXXRecordDecl();
1611+
16131612
// Kernel Object field is an array of structs. Handle struct array element.
16141613
if (const ConstantArrayType *CAT =
1615-
SemaRef.Context.getAsConstantArrayType(FieldTy)) {
1616-
CXXRecordDecl *RD = CAT->getElementType()->getAsCXXRecordDecl();
1617-
addStructInit(RD);
1618-
return true;
1619-
}
1620-
1621-
const CXXRecordDecl *RD = FieldTy->getAsCXXRecordDecl();
1614+
SemaRef.Context.getAsConstantArrayType(FieldTy))
1615+
RD = CAT->getElementType()->getAsCXXRecordDecl();
16221616

16231617
// Initializers for accessors inside stream not added.
16241618
if (!Util::isSyclStreamType(FD->getType()))

0 commit comments

Comments
 (0)