diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-02-14 02:46:03 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-02-14 02:46:03 +0000 |
commit | 7473b1c6e7ba2654d4a0d469198f0e01b485b51a (patch) | |
tree | dd0142b48cacb81c2d52e0e377aa73161aad429b /tools/c-index-test | |
parent | 8be51eab5ad34515d2a40dcdc8558128ca1800ad (diff) |
Implement new DiagnosticsRenderer that packages notes retrieved by clang_getDiagnosticSetFromTU() as
child diagnostics of primary diagnostics. By using the DiagnosticRenderer, these Diagnostics now
match with those generated for serialized diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150456 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/c-index-test')
-rw-r--r-- | tools/c-index-test/c-index-test.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 03eeb511cd..548c40e176 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -418,13 +418,21 @@ void PrintDiagnostic(CXDiagnostic Diagnostic) { } } -void PrintDiagnostics(CXTranslationUnit TU) { - int i, n = clang_getNumDiagnostics(TU); - for (i = 0; i != n; ++i) { - CXDiagnostic Diag = clang_getDiagnostic(TU, i); +void PrintDiagnosticSet(CXDiagnosticSet Set) { + int i = 0, n = clang_getNumDiagnosticsInSet(Set); + for ( ; i != n ; ++i) { + CXDiagnostic Diag = clang_getDiagnosticInSet(Set, i); + CXDiagnosticSet ChildDiags = clang_getChildDiagnostics(Diag); PrintDiagnostic(Diag); - clang_disposeDiagnostic(Diag); - } + if (ChildDiags) + PrintDiagnosticSet(ChildDiags); + } +} + +void PrintDiagnostics(CXTranslationUnit TU) { + CXDiagnosticSet TUSet = clang_getDiagnosticSetFromTU(TU); + PrintDiagnosticSet(TUSet); + clang_disposeDiagnosticSet(TUSet); } void PrintMemoryUsage(CXTranslationUnit TU) { |