diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-02-05 11:42:03 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-02-05 11:42:03 +0000 |
commit | 64e7bdc1d4c8c2f40f32e699014e85fbe1be57f7 (patch) | |
tree | 08a1067d2dbc8e34d2aeb320a33e3b1af74ee9ff /bindings/python/clang/cindex.py | |
parent | ea403825faa5b8780a9b44277e6a2c68d7849146 (diff) |
[clang.py] Implement Cursor.hash
Contributed by: Gregory Szorc <gregory.szorc@gmail.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149826 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/python/clang/cindex.py')
-rw-r--r-- | bindings/python/clang/cindex.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py index e385ca2893..4c9f96ddb3 100644 --- a/bindings/python/clang/cindex.py +++ b/bindings/python/clang/cindex.py @@ -969,6 +969,14 @@ class Cursor(Structure): self._type = Cursor_type(self) return self._type + @property + def hash(self): + """Returns a hash of the cursor as an int.""" + if not hasattr(self, '_hash'): + self._hash = Cursor_hash(self) + + return self._hash + def get_children(self): """Return an iterator for accessing the children of this cursor.""" @@ -1735,6 +1743,10 @@ Cursor_eq = lib.clang_equalCursors Cursor_eq.argtypes = [Cursor, Cursor] Cursor_eq.restype = c_uint +Cursor_hash = lib.clang_hashCursor +Cursor_hash.argtypes = [Cursor] +Cursor_hash.restype = c_uint + Cursor_spelling = lib.clang_getCursorSpelling Cursor_spelling.argtypes = [Cursor] Cursor_spelling.restype = _CXString |