diff options
author | Gregory Szorc <gregory.szorc@gmail.com> | 2012-02-20 17:44:49 +0000 |
---|---|---|
committer | Gregory Szorc <gregory.szorc@gmail.com> | 2012-02-20 17:44:49 +0000 |
commit | 7eb691a7b61ba895695bbbf92e944d98ef49390d (patch) | |
tree | 7c42095897376be04a13407a5e8a58f49e491e58 /bindings/python/clang/cindex.py | |
parent | 83bc276de6cc2c0b8e2fa535048cd8edad1c94b1 (diff) |
[clang.py] Implement Type.__eq__ and Type.__ne__
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150969 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/python/clang/cindex.py')
-rw-r--r-- | bindings/python/clang/cindex.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py index d01d1db31a..e2ef3c3665 100644 --- a/bindings/python/clang/cindex.py +++ b/bindings/python/clang/cindex.py @@ -1245,6 +1245,15 @@ class Type(Structure): """ return Type_get_array_size(self) + def __eq__(self, other): + if type(other) != type(self): + return False + + return Type_equal(self, other) + + def __ne__(self, other): + return not self.__eq__(other) + ## CIndex Objects ## # CIndex objects (derived from ClangObject) are essentially lightweight @@ -1936,6 +1945,10 @@ Type_get_array_size = lib.clang_getArraySize Type_get_array_size.argtype = [Type] Type_get_array_size.restype = c_longlong +Type_equal = lib.clang_equalTypes +Type_equal.argtypes = [Type, Type] +Type_equal.restype = bool + # Index Functions Index_create = lib.clang_createIndex Index_create.argtypes = [c_int, c_int] |