@@ -171,7 +171,7 @@ def dimensions(self):
171
171
def access_mode (self ):
172
172
return self .type ().access_mode ()
173
173
174
- def subscript_int (self , subscript ):
174
+ def subscript_sizet (self , subscript ):
175
175
return self .data ()[subscript ]
176
176
177
177
def subscript_id (self , subscript ):
@@ -185,25 +185,6 @@ def subscript_id(self, subscript):
185
185
def subscript_item (self , subscript ):
186
186
return self .subscript_id (SYCLItem (subscript ).index ())
187
187
188
- def __getitem__ (self , subscript ):
189
- code = subscript .type .unqualified ().code
190
- if code == gdb .TYPE_CODE_INT :
191
- return self .subscript_int (subscript )
192
- elif (
193
- code == gdb .TYPE_CODE_STRUCT
194
- and subscript .type .name .startswith ("sycl::_V1::item<" )
195
- and subscript .type .name .endswith (">" )
196
- ):
197
- return self .subscript_item (subscript )
198
- elif (
199
- code == gdb .TYPE_CODE_STRUCT
200
- and subscript .type .name .startswith ("sycl::_V1::id<" )
201
- and subscript .type .name .endswith (">" )
202
- ):
203
- return self .subscript_id (subscript )
204
- else :
205
- raise AttributeError ("Unsupported sycl::accessor subscript type." )
206
-
207
188
def impl (self ):
208
189
return self .gdb_value ()["impl" ]
209
190
@@ -511,7 +492,9 @@ def __init__(self, name):
511
492
self .name = name
512
493
513
494
def matches (self , type ):
514
- return type .name == self .name or type .name .startswith (self .name + "<" )
495
+ return type .name != None and (
496
+ type .name == self .name or type .name .startswith (self .name + "<" )
497
+ )
515
498
516
499
def instantiate (self ):
517
500
return SYCLTypePrinter .Recognizer (self )
@@ -682,7 +665,7 @@ def gdb_type(self):
682
665
@staticmethod
683
666
def data_vector_type (base_type , dimensions , ranges_array ):
684
667
vector_type = base_type
685
- for index in range (dimensions ):
668
+ for index in reversed ( range (dimensions ) ):
686
669
upperbound = ranges_array [index ]
687
670
inclusive_upperbound = upperbound - 1
688
671
vector_type = vector_type .vector (inclusive_upperbound )
@@ -1202,8 +1185,8 @@ def get_arg_types(self):
1202
1185
def size_type (self ):
1203
1186
return SYCLType .size_type ()
1204
1187
1205
- def __call__ (self , accessor_ptr , subscript ):
1206
- return SYCLAccessor (accessor_ptr .dereference ())[ subscript ]
1188
+ def __call__ (self , ptr , subscript ):
1189
+ return SYCLAccessor (ptr .dereference ()). subscript_sizet ( subscript )
1207
1190
1208
1191
1209
1192
class SYCLAccessorSubscriptID (SYCLAccessorSubscript ):
@@ -1217,8 +1200,8 @@ def id_type(self):
1217
1200
dimensions = SYCLAccessorType (self .class_type ()).dimensions ()
1218
1201
return gdb .lookup_type (f"sycl::_V1::id<{ dimensions } >" )
1219
1202
1220
- def __call__ (self , accessor_ptr , subscript ):
1221
- return SYCLAccessor (accessor_ptr .dereference ())[ subscript ]
1203
+ def __call__ (self , ptr , subscript ):
1204
+ return SYCLAccessor (ptr .dereference ()). subscript_id ( subscript )
1222
1205
1223
1206
1224
1207
class SYCLAccessorSubscriptItem (SYCLAccessorSubscript ):
@@ -1240,8 +1223,8 @@ def item_type(self):
1240
1223
except :
1241
1224
return None
1242
1225
1243
- def __call__ (self , accessor_ptr , subscript ):
1244
- return SYCLAccessor (accessor_ptr .dereference ())[ subscript ]
1226
+ def __call__ (self , ptr , subscript ):
1227
+ return SYCLAccessor (ptr .dereference ()). subscript_item ( subscript )
1245
1228
1246
1229
1247
1230
class SYCLAccessorSubscriptItemOffset (SYCLAccessorSubscriptItem ):
0 commit comments