@@ -2133,6 +2133,14 @@ def get_field_offsetof(self):
21332133 """Returns the offsetof the FIELD_DECL pointed by this Cursor."""
21342134 return conf .lib .clang_Cursor_getOffsetOfField (self ) # type: ignore [no-any-return]
21352135
2136+ def get_base_offsetof (self , parent ):
2137+ """Returns the offsetof the CXX_BASE_SPECIFIER pointed by this Cursor."""
2138+ return conf .lib .clang_getOffsetOfBase (parent , self ) # type: ignore [no-any-return]
2139+
2140+ def is_virtual_base (self ):
2141+ """Returns whether the CXX_BASE_SPECIFIER pointed by this Cursor is virtual."""
2142+ return conf .lib .clang_isVirtualBase (self ) # type: ignore [no-any-return]
2143+
21362144 def is_anonymous (self ):
21372145 """
21382146 Check whether this is a record type without a name, or a field where
@@ -2687,6 +2695,21 @@ def visitor(field, children):
26872695 conf .lib .clang_Type_visitFields (self , fields_visit_callback (visitor ), fields )
26882696 return iter (fields )
26892697
2698+ def get_bases (self ):
2699+ """Return an iterator for accessing the base classes of this type."""
2700+
2701+ def visitor (base , children ):
2702+ assert base != conf .lib .clang_getNullCursor ()
2703+
2704+ # Create reference to TU so it isn't GC'd before Cursor.
2705+ base ._tu = self ._tu
2706+ bases .append (base )
2707+ return 1 # continue
2708+
2709+ bases : list [Cursor ] = []
2710+ conf .lib .clang_visitCXXBaseClasses (self , fields_visit_callback (visitor ), bases )
2711+ return iter (bases )
2712+
26902713 def get_exception_specification_kind (self ):
26912714 """
26922715 Return the kind of the exception specification; a value from
@@ -3940,6 +3963,7 @@ def set_property(self, property, value):
39403963 ("clang_getNumDiagnosticsInSet" , [c_object_p ], c_uint ),
39413964 ("clang_getNumElements" , [Type ], c_longlong ),
39423965 ("clang_getNumOverloadedDecls" , [Cursor ], c_uint ),
3966+ ("clang_getOffsetOfBase" , [Cursor , Cursor ], c_longlong ),
39433967 ("clang_getOverloadedDecl" , [Cursor , c_uint ], Cursor ),
39443968 ("clang_getPointeeType" , [Type ], Type ),
39453969 ("clang_getRange" , [SourceLocation , SourceLocation ], SourceRange ),
@@ -3992,6 +4016,7 @@ def set_property(self, property, value):
39924016 [TranslationUnit , SourceRange , POINTER (POINTER (Token )), POINTER (c_uint )],
39934017 ),
39944018 ("clang_visitChildren" , [Cursor , cursor_visit_callback , py_object ], c_uint ),
4019+ ("clang_visitCXXBaseClasses" , [Type , fields_visit_callback , py_object ], c_uint ),
39954020 ("clang_Cursor_getNumArguments" , [Cursor ], c_int ),
39964021 ("clang_Cursor_getArgument" , [Cursor , c_uint ], Cursor ),
39974022 ("clang_Cursor_getNumTemplateArguments" , [Cursor ], c_int ),
0 commit comments