@@ -171,7 +171,7 @@ def dimensions(self):
171171 def access_mode (self ):
172172 return self .type ().access_mode ()
173173
174- def subscript_int (self , subscript ):
174+ def subscript_sizet (self , subscript ):
175175 return self .data ()[subscript ]
176176
177177 def subscript_id (self , subscript ):
@@ -185,25 +185,6 @@ def subscript_id(self, subscript):
185185 def subscript_item (self , subscript ):
186186 return self .subscript_id (SYCLItem (subscript ).index ())
187187
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-
207188 def impl (self ):
208189 return self .gdb_value ()["impl" ]
209190
@@ -511,7 +492,9 @@ def __init__(self, name):
511492 self .name = name
512493
513494 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+ )
515498
516499 def instantiate (self ):
517500 return SYCLTypePrinter .Recognizer (self )
@@ -682,7 +665,7 @@ def gdb_type(self):
682665 @staticmethod
683666 def data_vector_type (base_type , dimensions , ranges_array ):
684667 vector_type = base_type
685- for index in range (dimensions ):
668+ for index in reversed ( range (dimensions ) ):
686669 upperbound = ranges_array [index ]
687670 inclusive_upperbound = upperbound - 1
688671 vector_type = vector_type .vector (inclusive_upperbound )
@@ -1202,8 +1185,8 @@ def get_arg_types(self):
12021185 def size_type (self ):
12031186 return SYCLType .size_type ()
12041187
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 )
12071190
12081191
12091192class SYCLAccessorSubscriptID (SYCLAccessorSubscript ):
@@ -1217,8 +1200,8 @@ def id_type(self):
12171200 dimensions = SYCLAccessorType (self .class_type ()).dimensions ()
12181201 return gdb .lookup_type (f"sycl::_V1::id<{ dimensions } >" )
12191202
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 )
12221205
12231206
12241207class SYCLAccessorSubscriptItem (SYCLAccessorSubscript ):
@@ -1240,8 +1223,8 @@ def item_type(self):
12401223 except :
12411224 return None
12421225
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 )
12451228
12461229
12471230class SYCLAccessorSubscriptItemOffset (SYCLAccessorSubscriptItem ):
0 commit comments