From acc98ca43c376526ef31a618c774b230d6e6f51d Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sat, 30 Apr 2016 21:14:01 +0000 Subject: 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! llvm-svn: 268167 --- clang/bindings/python/tests/cindex/test_diagnostics.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'clang/bindings/python/tests') diff --git a/clang/bindings/python/tests/cindex/test_diagnostics.py b/clang/bindings/python/tests/cindex/test_diagnostics.py index 48ab6176fd1..ba6e545e8b1 100644 --- a/clang/bindings/python/tests/cindex/test_diagnostics.py +++ b/clang/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 -- cgit v1.2.3