diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-02-22 23:17:23 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-02-22 23:17:23 +0000 |
commit | 274f1906f12ebf8fcc179701deeda6d3271120c1 (patch) | |
tree | 9c7e2a89b58475d482ab2e926b337e9d5d3b8d8f /tools/c-index-test/c-index-test.c | |
parent | 83c481ade785a919ba21a33f9a8b1b21c1212fb3 (diff) |
Rework the CIndex API for displaying diagnostics. Instead of printing
the diagnostics to a FILE*, return a CXString containing the formatted
diagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96823 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/c-index-test/c-index-test.c')
-rw-r--r-- | tools/c-index-test/c-index-test.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 2207364266..34bb990246 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -198,14 +198,18 @@ typedef void (*PostVisitTU)(CXTranslationUnit); void PrintDiagnostic(CXDiagnostic Diagnostic) { FILE *out = stderr; CXFile file; + CXString Msg; unsigned display_opts = CXDiagnostic_DisplaySourceLocation | CXDiagnostic_DisplayColumn | CXDiagnostic_DisplaySourceRanges; unsigned i, num_fixits; - - clang_displayDiagnostic(Diagnostic, out, display_opts); + if (clang_getDiagnosticSeverity(Diagnostic) == CXDiagnostic_Ignored) return; + Msg = clang_formatDiagnostic(Diagnostic, display_opts); + fprintf(stderr, "%s\n", clang_getCString(Msg)); + clang_disposeString(Msg); + clang_getInstantiationLocation(clang_getDiagnosticLocation(Diagnostic), &file, 0, 0, 0); if (!file) |