diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-02-05 11:42:09 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-02-05 11:42:09 +0000 |
commit | 49bd32c1d29e8205466391f7fd675da01d9635ff (patch) | |
tree | d17a8ab87a17ac8d09acd24a9de35f0f5c389aa7 /clang/bindings/python | |
parent | ebb0ae82a21cf238a581b35c8fd85540cf41cac0 (diff) | |
download | bcm5719-llvm-49bd32c1d29e8205466391f7fd675da01d9635ff.tar.gz bcm5719-llvm-49bd32c1d29e8205466391f7fd675da01d9635ff.zip |
[clang.py] Add CursorKind.{is_translation_unit, is_preprocessing, is_unexposed}
Contributed by: Gregory Szorc <gregory.szorc@gmail.com>
llvm-svn: 149827
Diffstat (limited to 'clang/bindings/python')
-rw-r--r-- | clang/bindings/python/clang/cindex.py | 24 | ||||
-rw-r--r-- | clang/bindings/python/tests/cindex/test_cursor_kind.py | 9 |
2 files changed, 33 insertions, 0 deletions
diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py index 4c9f96ddb38..38f117bb1d8 100644 --- a/clang/bindings/python/clang/cindex.py +++ b/clang/bindings/python/clang/cindex.py @@ -379,6 +379,18 @@ class CursorKind(object): """Test if this is an invalid kind.""" return CursorKind_is_inv(self) + def is_translation_unit(self): + """Test if this is a translation unit kind.""" + return CursorKind_is_translation_unit(self) + + def is_preprocessing(self): + """Test if this is a preprocessing kind.""" + return CursorKind_is_preprocessing(self) + + def is_unexposed(self): + """Test if this is an unexposed kind.""" + return CursorKind_is_unexposed(self) + def __repr__(self): return 'CursorKind.%s' % (self.name,) @@ -1716,6 +1728,18 @@ CursorKind_is_inv = lib.clang_isInvalid CursorKind_is_inv.argtypes = [CursorKind] CursorKind_is_inv.restype = bool +CursorKind_is_translation_unit = lib.clang_isTranslationUnit +CursorKind_is_translation_unit.argtypes = [CursorKind] +CursorKind_is_translation_unit.restype = bool + +CursorKind_is_preprocessing = lib.clang_isPreprocessing +CursorKind_is_preprocessing.argtypes = [CursorKind] +CursorKind_is_preprocessing.restype = bool + +CursorKind_is_unexposed = lib.clang_isUnexposed +CursorKind_is_unexposed.argtypes = [CursorKind] +CursorKind_is_unexposed.restype = bool + # Cursor Functions # TODO: Implement this function Cursor_get = lib.clang_getCursor diff --git a/clang/bindings/python/tests/cindex/test_cursor_kind.py b/clang/bindings/python/tests/cindex/test_cursor_kind.py index d7a1cfad8f9..f8466e5e0d1 100644 --- a/clang/bindings/python/tests/cindex/test_cursor_kind.py +++ b/clang/bindings/python/tests/cindex/test_cursor_kind.py @@ -16,6 +16,15 @@ def test_kind_groups(): assert CursorKind.UNEXPOSED_STMT.is_statement() assert CursorKind.INVALID_FILE.is_invalid() + assert CursorKind.TRANSLATION_UNIT.is_translation_unit() + assert not CursorKind.TYPE_REF.is_translation_unit() + + assert CursorKind.PREPROCESSING_DIRECTIVE.is_preprocessing() + assert not CursorKind.TYPE_REF.is_preprocessing() + + assert CursorKind.UNEXPOSED_DECL.is_unexposed() + assert not CursorKind.TYPE_REF.is_unexposed() + for k in CursorKind.get_all_kinds(): group = [n for n in ('is_declaration', 'is_reference', 'is_expression', 'is_statement', 'is_invalid', 'is_attribute') |