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 | d770f73facd5cca11567b651c0dda86dc2bc96ea (patch) | |
tree | c581951ead3b9aedba3de080daab3ccb67e31e90 /clang/tools/c-index-test/c-index-test.c | |
parent | 45fceea0e45b5440675b3c18d6d1d26eacf606e1 (diff) | |
download | bcm5719-llvm-d770f73facd5cca11567b651c0dda86dc2bc96ea.tar.gz bcm5719-llvm-d770f73facd5cca11567b651c0dda86dc2bc96ea.zip |
Rework the CIndex API for displaying diagnostics. Instead of printing
the diagnostics to a FILE*, return a CXString containing the formatted
diagnostic.
llvm-svn: 96823
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 2207364266f..34bb9902465 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/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) |