diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-02-08 23:11:56 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-02-08 23:11:56 +0000 |
commit | 4b8fd6d3d3d3ceb71c1f460145d84adf9a3813df (patch) | |
tree | e454b25b4f5a908d521972916049571d22e63ce2 /clang/tools/c-index-test/c-index-test.c | |
parent | ebc970e4eba91de5f444e06b8470775278392cf8 (diff) | |
download | bcm5719-llvm-4b8fd6d3d3d3ceb71c1f460145d84adf9a3813df.tar.gz bcm5719-llvm-4b8fd6d3d3d3ceb71c1f460145d84adf9a3813df.zip |
Clean up the CIndex interface to diagnostic ranges. Thanks, Daniel!
llvm-svn: 95602
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 658412c75ab..423fa9343af 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -196,20 +196,20 @@ static void PrintDiagnosticCallback(CXDiagnostic Diagnostic, clang_getInstantiationLocation(clang_getDiagnosticLocation(Diagnostic), &file, &line, &column, 0); if (file) { - CXSourceRange *ranges = 0; - unsigned num_ranges; - unsigned i; + unsigned i, n; unsigned printed_any_ranges = 0; fprintf(out, "%s:%d:%d:", clang_getFileName(file), line, column); - clang_getDiagnosticRanges(Diagnostic, &ranges, &num_ranges); - for (i = 0; i != num_ranges; ++i) { + n = clang_getDiagnosticNumRanges(Diagnostic); + for (i = 0; i != n; ++i) { CXFile start_file, end_file; + CXSourceRange range = clang_getDiagnosticRange(Diagnostic, i); + unsigned start_line, start_column, end_line, end_column; - clang_getInstantiationLocation(clang_getRangeStart(ranges[i]), + clang_getInstantiationLocation(clang_getRangeStart(range), &start_file, &start_line, &start_column,0); - clang_getInstantiationLocation(clang_getRangeEnd(ranges[i]), + clang_getInstantiationLocation(clang_getRangeEnd(range), &end_file, &end_line, &end_column, 0); if (start_file != end_file || start_file != file) @@ -219,7 +219,6 @@ static void PrintDiagnosticCallback(CXDiagnostic Diagnostic, end_column+1); printed_any_ranges = 1; } - clang_disposeDiagnosticRanges(ranges, num_ranges); if (printed_any_ranges) fprintf(out, ":"); |