diff options
author | Gregory Szorc <gregory.szorc@gmail.com> | 2012-05-14 03:56:33 +0000 |
---|---|---|
committer | Gregory Szorc <gregory.szorc@gmail.com> | 2012-05-14 03:56:33 +0000 |
commit | 2c40835c21cd435f183da3d4754aff6beeaef9f6 (patch) | |
tree | 51dc53a61cccc7f2b5948f03d0bd26d27b53eb44 /bindings/python/clang/cindex.py | |
parent | 1e370ab68e5b69fc40a782ee5ce01ec2c6857879 (diff) |
[clang.py] Implement Cursor.canonical
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156753 91177308-0d34-0410-b5e6-96231b3b80d8
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 |