@@ -1144,25 +1144,78 @@ template <typename Derived> class SyclKernelFieldHandler {
1144
1144
// should be still working.
1145
1145
1146
1146
// Accessor can be a base class or a field decl, so both must be handled.
1147
- virtual void handleSyclAccessorType (const CXXBaseSpecifier &, QualType) {}
1148
- virtual void handleSyclAccessorType (const FieldDecl *, QualType) {}
1149
- virtual void handleSyclSamplerType (const FieldDecl *, QualType) {}
1150
- virtual void handleSyclSpecConstantType (const FieldDecl *, QualType) {}
1151
- virtual void handleSyclStreamType (const CXXBaseSpecifier &, QualType) {}
1152
- virtual void handleSyclStreamType (const FieldDecl *, QualType) {}
1153
- virtual void handleStructType (const FieldDecl *, QualType) {}
1154
- virtual void handleReferenceType (const FieldDecl *, QualType) {}
1155
- virtual void handlePointerType (const FieldDecl *, QualType) {}
1156
- virtual void handleArrayType (const FieldDecl *, QualType) {}
1157
- virtual void handleScalarType (const FieldDecl *, QualType) {}
1147
+ virtual void handleSyclAccessorType (CXXBaseSpecifier &, QualType) {}
1148
+ virtual void handleSyclAccessorType (FieldDecl *, QualType) {}
1149
+ virtual void handleSyclSamplerType (FieldDecl *, QualType) {}
1150
+ virtual void handleSyclSpecConstantType (FieldDecl *, QualType) {}
1151
+ virtual void handleSyclStreamType (CXXBaseSpecifier &, QualType) {}
1152
+ virtual void handleSyclStreamType (FieldDecl *, QualType) {}
1153
+ virtual void handleStructType (FieldDecl *, QualType) {}
1154
+ virtual void handleReferenceType (FieldDecl *, QualType) {}
1155
+ virtual void handlePointerType (FieldDecl *, QualType) {}
1156
+ virtual void handleArrayType (FieldDecl *, QualType) {}
1157
+ virtual void handleScalarType (FieldDecl *, QualType) {}
1158
1158
// Most handlers shouldn't be handling this, just the field checker.
1159
- virtual void handleOtherType (const FieldDecl *, QualType) {}
1159
+ virtual void handleOtherType (FieldDecl *, QualType) {}
1160
+
1161
+ // TODO: fix warnings from derived classes
1162
+ virtual void handleSyclAccessorType (const CXXBaseSpecifier &BS, QualType Ty) {
1163
+ static_cast <Derived *>(this )->handleSyclAccessorType (
1164
+ const_cast <CXXBaseSpecifier &>(BS), Ty);
1165
+ }
1166
+ virtual void handleSyclAccessorType (const FieldDecl *FD, QualType Ty) {
1167
+ static_cast <Derived *>(this )->handleSyclAccessorType (
1168
+ const_cast <FieldDecl *>(FD), Ty);
1169
+ }
1170
+ virtual void handleSyclStreamType (const CXXBaseSpecifier &BS, QualType Ty) {
1171
+ static_cast <Derived *>(this )->handleSyclStreamType (
1172
+ const_cast <CXXBaseSpecifier &>(BS), Ty);
1173
+ }
1174
+ virtual void handleSyclStreamType (const FieldDecl *FD, QualType Ty) {
1175
+ static_cast <Derived *>(this )->handleSyclStreamType (
1176
+ const_cast <FieldDecl *>(FD), Ty);
1177
+ }
1178
+ virtual void handleSyclSamplerType (const FieldDecl *FD, QualType Ty) {
1179
+ static_cast <Derived *>(this )->handleSyclSamplerType (
1180
+ const_cast <FieldDecl *>(FD), Ty);
1181
+ }
1182
+ virtual void handleSyclSpecConstantType (const FieldDecl *FD, QualType Ty) {
1183
+ static_cast <Derived *>(this )->handleSyclSpecConstantType (
1184
+ const_cast <FieldDecl *>(FD), Ty);
1185
+ }
1186
+ virtual void handleStructType (const FieldDecl *FD, QualType Ty) {
1187
+ static_cast <Derived *>(this )->handleStructType (
1188
+ const_cast <FieldDecl *>(FD), Ty);
1189
+ }
1190
+ virtual void handleReferenceType (const FieldDecl *FD, QualType Ty) {
1191
+ static_cast <Derived *>(this )->handleReferenceType (
1192
+ const_cast <FieldDecl *>(FD), Ty);
1193
+ }
1194
+ virtual void handlePointerType (const FieldDecl *FD, QualType Ty) {
1195
+ static_cast <Derived *>(this )->handlePointerType (
1196
+ const_cast <FieldDecl *>(FD), Ty);
1197
+ }
1198
+ virtual void handleArrayType (const FieldDecl *FD, QualType Ty) {
1199
+ static_cast <Derived *>(this )->handleArrayType (
1200
+ const_cast <FieldDecl *>(FD), Ty);
1201
+ }
1202
+ virtual void handleScalarType (const FieldDecl *FD, QualType Ty) {
1203
+ static_cast <Derived *>(this )->handleScalarType (
1204
+ const_cast <FieldDecl *>(FD), Ty);
1205
+ }
1206
+ virtual void handleOtherType (const FieldDecl *FD, QualType Ty) {
1207
+ static_cast <Derived *>(this )->handleOtherType (
1208
+ const_cast <FieldDecl *>(FD), Ty);
1209
+ }
1160
1210
1161
1211
// The following are only used for keeping track of where we are in the base
1162
1212
// class/field graph. Int Headers use this to calculate offset, most others
1163
1213
// don't have a need for these.
1214
+ virtual void enterStruct (const CXXRecordDecl *, FieldDecl *) {}
1164
1215
1165
- virtual void enterStruct (const CXXRecordDecl *, const FieldDecl *) {}
1216
+ virtual void enterStruct (const CXXRecordDecl *RD, const FieldDecl *FD) {
1217
+ static_cast <Derived *>(this )->enterStruct (RD, const_cast <FieldDecl *>(FD));
1218
+ }
1166
1219
virtual void leaveStruct (const CXXRecordDecl *, const FieldDecl *) {}
1167
1220
virtual void enterStruct (const CXXRecordDecl *, const CXXBaseSpecifier &) {}
1168
1221
virtual void leaveStruct (const CXXRecordDecl *, const CXXBaseSpecifier &) {}
@@ -1521,13 +1574,13 @@ class SyclKernelBodyCreator
1521
1574
DeclCreator.setBody (KernelBody);
1522
1575
}
1523
1576
1524
- void handleSyclAccessorType (const FieldDecl *FD, QualType Ty) final {
1577
+ void handleSyclAccessorType (FieldDecl *FD, QualType Ty) final {
1525
1578
const auto *AccDecl = Ty->getAsCXXRecordDecl ();
1526
1579
// TODO : we don't need all this init stuff if remove kernel obj clone
1527
1580
// Perform initialization only if it is field of kernel object
1528
1581
if (Bases.size () == 1 ) {
1529
- InitializedEntity Entity = InitializedEntity::InitializeMember (
1530
- const_cast <FieldDecl *> (FD) , &VarEntity);
1582
+ InitializedEntity Entity =
1583
+ InitializedEntity::InitializeMember (FD, &VarEntity);
1531
1584
// Initialize with the default constructor.
1532
1585
InitializationKind InitKind =
1533
1586
InitializationKind::CreateDefault (SourceLocation ());
@@ -1536,8 +1589,7 @@ class SyclKernelBodyCreator
1536
1589
InitExprs.push_back (MemberInit.get ());
1537
1590
}
1538
1591
// TODO don't do const-cast
1539
- createSpecialMethodCall (AccDecl, Bases.back (), InitMethodName,
1540
- const_cast <FieldDecl *>(FD));
1592
+ createSpecialMethodCall (AccDecl, Bases.back (), InitMethodName, FD);
1541
1593
}
1542
1594
1543
1595
void handleSyclAccessorType (const CXXBaseSpecifier &BS, QualType Ty) final {
@@ -1556,16 +1608,16 @@ class SyclKernelBodyCreator
1556
1608
// TODO: Creates init/finalize sequence and inits special sycl obj
1557
1609
}
1558
1610
1559
- void handleStructType (const FieldDecl *FD, QualType Ty) final {
1560
- createExprForStructOrScalar (const_cast <FieldDecl *>(FD) );
1611
+ void handleStructType (FieldDecl *FD, QualType Ty) final {
1612
+ createExprForStructOrScalar (FD );
1561
1613
}
1562
1614
1563
- void handleScalarType (const FieldDecl *FD, QualType Ty) final {
1564
- createExprForStructOrScalar (const_cast <FieldDecl *>(FD) );
1615
+ void handleScalarType (FieldDecl *FD, QualType Ty) final {
1616
+ createExprForStructOrScalar (FD );
1565
1617
}
1566
1618
1567
- void enterStruct (const CXXRecordDecl *, const FieldDecl *FD) final {
1568
- Bases.push_back (BuildMemberExpr (Bases.back (), const_cast <FieldDecl *>(FD) ));
1619
+ void enterStruct (const CXXRecordDecl *, FieldDecl *FD) final {
1620
+ Bases.push_back (BuildMemberExpr (Bases.back (), FD ));
1569
1621
}
1570
1622
1571
1623
void leaveStruct (const CXXRecordDecl *, const FieldDecl *FD) final {
0 commit comments