diff options
Diffstat (limited to 'bindings/python/clang/cindex.py')
-rw-r--r-- | bindings/python/clang/cindex.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py index d048fb60c4..54a3bfda4d 100644 --- a/bindings/python/clang/cindex.py +++ b/bindings/python/clang/cindex.py @@ -1024,6 +1024,20 @@ class Cursor(Structure): return self._type @property + def canonical(self): + """Return the canonical Cursor corresponding to this Cursor. + + The canonical cursor is the cursor which is representative for the + underlying entity. For example, if you have multiple forward + declarations for the same class, the canonical cursor for the forward + declarations will be identical. + """ + if not hasattr(self, '_canonical'): + self._canonical = Cursor_canonical(self) + + return self._canonical + + @property def result_type(self): """Retrieve the Type of the result for this Cursor.""" if not hasattr(self, '_result_type'): @@ -2150,6 +2164,11 @@ Cursor_ref.argtypes = [Cursor] Cursor_ref.restype = Cursor Cursor_ref.errcheck = Cursor.from_result +Cursor_canonical = lib.clang_getCanonicalCursor +Cursor_canonical.argtypes = [Cursor] +Cursor_canonical.restype = Cursor +Cursor_canonical.errcheck = Cursor.from_result + Cursor_type = lib.clang_getCursorType Cursor_type.argtypes = [Cursor] Cursor_type.restype = Type |