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 | a3890baf1256ff26081306c7fef70202f8223f41 (patch) | |
tree | 1fd9ea522f3758e36c729c7c537f3b791dba47fa /tools/c-index-test/c-index-test.c | |
parent | 5769d6195087229770d7ac90449443e026c47103 (diff) |
Clean up the CIndex interface to diagnostic ranges. Thanks, Daniel!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95602 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 | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 658412c75a..423fa9343a 100644 --- a/tools/c-index-test/c-index-test.c +++ b/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, ":"); |