diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-04-30 21:14:01 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-04-30 21:14:01 +0000 |
commit | 6f153a633205695fe46fac5d14ab860e06ece0d6 (patch) | |
tree | f46d0b759017696ddb020086a6a685c4d505d263 /bindings/python/tests | |
parent | c0875f9e196d4b2aacf5678edb1e4a7dd2443d1a (diff) |
python: add bindings for children of diagnostics
This exposes the Clang API bindings clang_getChildDiagnostics (which returns a
CXDiagnosticSet) and clang_getNumDiagnosticsInSet / clang_getDiagnosticInSet (to
traverse the CXDiagnosticSet), and adds a helper children property in the Python
Diagnostic wrapper.
Also, this adds the missing OVERLOAD_CANDIDATE (700) cursor type.
Patch by Hanson Wang!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268167 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/python/tests')
-rw-r--r-- | bindings/python/tests/cindex/test_diagnostics.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bindings/python/tests/cindex/test_diagnostics.py b/bindings/python/tests/cindex/test_diagnostics.py index 48ab6176fd..ba6e545e8b 100644 --- a/bindings/python/tests/cindex/test_diagnostics.py +++ b/bindings/python/tests/cindex/test_diagnostics.py @@ -80,3 +80,15 @@ def test_diagnostic_option(): assert d.option == '-Wunused-parameter' assert d.disable_option == '-Wno-unused-parameter' + +def test_diagnostic_children(): + tu = get_tu('void f(int x) {} void g() { f(); }') + assert len(tu.diagnostics) == 1 + d = tu.diagnostics[0] + + children = d.children + assert len(children) == 1 + assert children[0].severity == Diagnostic.Note + assert children[0].spelling.endswith('declared here') + assert children[0].location.line == 1 + assert children[0].location.column == 1 |