@@ -1552,6 +1552,9 @@ def from_location(tu, location):
15521552
15531553 return cursor
15541554
1555+ def __hash__ (self ):
1556+ return self .hash
1557+
15551558 def __eq__ (self , other ):
15561559 return conf .lib .clang_equalCursors (self , other ) # type: ignore [no-any-return]
15571560
@@ -1797,7 +1800,7 @@ def mangled_name(self):
17971800 return self ._mangled_name
17981801
17991802 @property
1800- def location (self ):
1803+ def location (self ) -> SourceLocation :
18011804 """
18021805 Return the source location (the starting character) of the entity
18031806 pointed at by the cursor.
@@ -2022,6 +2025,14 @@ def lexical_parent(self):
20222025
20232026 return self ._lexical_parent
20242027
2028+ @property
2029+ def specialized_template (self ):
2030+ """Return the base template that this cursor is a specialization of, if any."""
2031+ return Cursor .from_cursor_result (
2032+ conf .lib .clang_getSpecializedCursorTemplate (self ),
2033+ self
2034+ )
2035+
20252036 @property
20262037 def translation_unit (self ):
20272038 """Returns the TranslationUnit to which this Cursor belongs."""
@@ -2143,6 +2154,9 @@ def get_bitfield_width(self):
21432154 """
21442155 return conf .lib .clang_getFieldDeclBitWidth (self ) # type: ignore [no-any-return]
21452156
2157+ def has_attrs (self ):
2158+ return bool (conf .lib .clang_Cursor_hasAttrs (self ))
2159+
21462160 @staticmethod
21472161 def from_result (res , arg ):
21482162 assert isinstance (res , Cursor )
@@ -3401,6 +3415,12 @@ def __str__(self):
34013415 def __repr__ (self ):
34023416 return "<File: %s>" % (self .name )
34033417
3418+ def __eq__ (self , other ):
3419+ return isinstance (other , File ) and bool (conf .lib .clang_File_isEqual (self , other ))
3420+
3421+ def __ne__ (self , other ):
3422+ return not self .__eq__ (other )
3423+
34043424 @staticmethod
34053425 def from_result (res , arg ):
34063426 assert isinstance (res , c_object_p )
@@ -3795,6 +3815,7 @@ def write_main_file_to_stdout(self):
37953815 ("clang_getCursorType" , [Cursor ], Type ),
37963816 ("clang_getCursorUSR" , [Cursor ], _CXString ),
37973817 ("clang_Cursor_getMangling" , [Cursor ], _CXString ),
3818+ ("clang_Cursor_hasAttrs" , [Cursor ], c_uint ),
37983819 # ("clang_getCXTUResourceUsage",
37993820 # [TranslationUnit],
38003821 # CXTUResourceUsage),
@@ -3819,6 +3840,7 @@ def write_main_file_to_stdout(self):
38193840 ("clang_getFile" , [TranslationUnit , c_interop_string ], c_object_p ),
38203841 ("clang_getFileName" , [File ], _CXString ),
38213842 ("clang_getFileTime" , [File ], c_uint ),
3843+ ("clang_File_isEqual" , [File , File ], c_int ),
38223844 ("clang_getIBOutletCollectionType" , [Cursor ], Type ),
38233845 ("clang_getIncludedFile" , [Cursor ], c_object_p ),
38243846 (
0 commit comments