diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-02-14 08:32:51 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-02-14 08:32:51 +0000 |
commit | 8f0bf81c0f3ab31881cc7db7914e6978bb2a19af (patch) | |
tree | 94e70adb85b1c891726c1225b84aa89322039a10 /tools/c-index-test/c-index-test.c | |
parent | 2389eff26431b4f77d3383157adb2c8ccc15ff69 (diff) |
c-index-test: Unify and always print half-open extents.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96160 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 b7ea47e675..1619616bb7 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -34,8 +34,9 @@ static void PrintDiagnosticCallback(CXDiagnostic Diagnostic, static void PrintExtent(FILE *out, unsigned begin_line, unsigned begin_column, unsigned end_line, unsigned end_column) { + /* FIXME: Remove this + 1. */ fprintf(out, "[%d:%d - %d:%d]", begin_line, begin_column, - end_line, end_column); + end_line, end_column + 1); } static unsigned CreateTranslationUnit(CXIndex Idx, const char *file, @@ -222,7 +223,7 @@ static void PrintDiagnosticCallback(CXDiagnostic Diagnostic, if (start_file != end_file || start_file != file) continue; - PrintExtent(out, start_line, start_column, end_line, end_column+1); + PrintExtent(out, start_line, start_column, end_line, end_column); printed_any_ranges = 1; } if (printed_any_ranges) @@ -277,7 +278,7 @@ static void PrintDiagnosticCallback(CXDiagnostic Diagnostic, &end_file, &end_line, &end_column, 0); if (start_file == file && end_file == file) { fprintf(out, "FIX-IT: Remove "); - PrintExtent(out, start_line, start_column, end_line, end_column+1); + PrintExtent(out, start_line, start_column, end_line, end_column); fprintf(out, "\n"); } break; @@ -295,7 +296,7 @@ static void PrintDiagnosticCallback(CXDiagnostic Diagnostic, &end_file, &end_line, &end_column, 0); if (start_file == end_file) { fprintf(out, "FIX-IT: Replace "); - PrintExtent(out, start_line, start_column, end_line, end_column+1); + PrintExtent(out, start_line, start_column, end_line, end_column); fprintf(out, " with \"%s\"\n", clang_getCString(text)); } clang_disposeString(text); @@ -582,7 +583,7 @@ static int perform_file_scan(const char *ast_file, const char *source_file, CXCursor prevCursor = clang_getNullCursor(); CXFile file; unsigned line = 1, col = 1; - unsigned start_line = 1, start_col = 1, prev_line = 0, prev_col = 0; + unsigned start_line = 1, start_col = 1; if (!(Idx = clang_createIndex(/* excludeDeclsFromPCH */ 1))) { fprintf(stderr, "Could not create Index\n"); @@ -615,7 +616,7 @@ static int perform_file_scan(const char *ast_file, const char *source_file, if ((c == EOF || !clang_equalCursors(cursor, prevCursor)) && prevCursor.kind != CXCursor_InvalidFile) { print_cursor_file_scan(prevCursor, start_line, start_col, - prev_line, prev_col, prefix); + line, col - 1, prefix); start_line = line; start_col = col; } @@ -623,8 +624,6 @@ static int perform_file_scan(const char *ast_file, const char *source_file, break; prevCursor = cursor; - prev_line = line; - prev_col = col; } fclose(fp); |