Skip to content

Commit 95ba2fe

Browse files
Use getBaseElementTypeUnsafe to replace unnecessary code
Signed-off-by: Elizabeth Andrews <[email protected]>
1 parent 707df53 commit 95ba2fe

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,13 +1604,10 @@ class SyclKernelBodyCreator
16041604
}
16051605

16061606
bool leaveStruct(const CXXRecordDecl *, FieldDecl *FD) final {
1607-
QualType FieldTy = FD->getType();
1608-
const CXXRecordDecl *RD = FieldTy->getAsCXXRecordDecl();
1609-
1610-
// Kernel Object field is an array of structs. Handle struct array element.
1611-
if (const ConstantArrayType *CAT =
1612-
SemaRef.Context.getAsConstantArrayType(FieldTy))
1613-
RD = CAT->getElementType()->getAsCXXRecordDecl();
1607+
// Handle struct when kernel object field is struct type or array of
1608+
// structs.
1609+
const CXXRecordDecl *RD =
1610+
FD->getType()->getBaseElementTypeUnsafe()->getAsCXXRecordDecl();
16141611

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

0 commit comments

Comments
 (0)