diff options
| author | Alex Lorenz <arphaman@gmail.com> | 2017-07-12 11:31:37 +0000 |
|---|---|---|
| committer | Alex Lorenz <arphaman@gmail.com> | 2017-07-12 11:31:37 +0000 |
| commit | 571b8cfac94bf030c8db74dc24e28301480ecb96 (patch) | |
| tree | 61d0b4edf903e6832eddb1c0f8236933cb2a62b2 /clang/bindings/python/tests/cindex | |
| parent | dab1d5f3cd6000da8b1e6bb1110c8788ac6a8aa1 (diff) | |
| download | bcm5719-llvm-571b8cfac94bf030c8db74dc24e28301480ecb96.tar.gz bcm5719-llvm-571b8cfac94bf030c8db74dc24e28301480ecb96.zip | |
[libclang] Support for querying whether an enum is scoped
This commit allows checking whether an enum declaration is scoped
through libclang and clang.cindex (Python).
Differential Revision: https://reviews.llvm.org/D35187
llvm-svn: 307769
Diffstat (limited to 'clang/bindings/python/tests/cindex')
| -rw-r--r-- | clang/bindings/python/tests/cindex/test_cursor.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/bindings/python/tests/cindex/test_cursor.py b/clang/bindings/python/tests/cindex/test_cursor.py index 8103e96df4f..4787ea931e1 100644 --- a/clang/bindings/python/tests/cindex/test_cursor.py +++ b/clang/bindings/python/tests/cindex/test_cursor.py @@ -255,6 +255,22 @@ def test_is_virtual_method(): assert foo.is_virtual_method() assert not bar.is_virtual_method() +def test_is_scoped_enum(): + """Ensure Cursor.is_scoped_enum works.""" + source = 'class X {}; enum RegularEnum {}; enum class ScopedEnum {};' + tu = get_tu(source, lang='cpp') + + cls = get_cursor(tu, 'X') + regular_enum = get_cursor(tu, 'RegularEnum') + scoped_enum = get_cursor(tu, 'ScopedEnum') + assert cls is not None + assert regular_enum is not None + assert scoped_enum is not None + + assert not cls.is_scoped_enum() + assert not regular_enum.is_scoped_enum() + assert scoped_enum.is_scoped_enum() + def test_underlying_type(): tu = get_tu('typedef int foo;') typedef = get_cursor(tu, 'foo') |

