diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-11-18 02:02:52 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-11-18 02:02:52 +0000 |
commit | 0469b7ea00e97700646ca1a873dee4ada131689e (patch) | |
tree | 8f39e8fba08a839a6893f2daf83a92f0ba94e6cd /clang/tools/c-index-test/c-index-test.c | |
parent | 9291bade4fff47783548ba73a6b0e1b8e18b9523 (diff) | |
download | bcm5719-llvm-0469b7ea00e97700646ca1a873dee4ada131689e.tar.gz bcm5719-llvm-0469b7ea00e97700646ca1a873dee4ada131689e.zip |
Add special clang_getCursor() support for @class. Handles <rdar://problem/7383421>.
llvm-svn: 89183
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index f5ddfa68da9..289dee96298 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -174,14 +174,19 @@ int perform_test_load_tu(const char *file, const char *filter) { static void print_cursor_file_scan(CXCursor cursor, unsigned start_line, unsigned start_col, - unsigned end_line, unsigned end_col) { - printf("CHECK: {start_line=%d start_col=%d end_line=%d end_col=%d} ", - start_line, start_col, end_line, end_col); + unsigned end_line, unsigned end_col, + const char *prefix) { + printf("// CHECK"); + if (prefix) + printf("-%s", prefix); + printf("{start_line=%d start_col=%d end_line=%d end_col=%d} ", + start_line, start_col, end_line, end_col); PrintCursor(cursor); printf("\n"); } -static int perform_file_scan(const char *ast_file, const char *source_file) { +static int perform_file_scan(const char *ast_file, const char *source_file, + const char *prefix) { CXIndex Idx; CXTranslationUnit TU; FILE *fp; @@ -230,7 +235,7 @@ static int perform_file_scan(const char *ast_file, const char *source_file) { if (!clang_equalCursors(cursor, prevCursor) && prevCursor.kind != CXCursor_InvalidFile) { print_cursor_file_scan(prevCursor, start_line, start_col, - last_line, last_col); + last_line, last_col, prefix); printed = 1; start_line = line; start_col = (unsigned) i+1; @@ -247,7 +252,7 @@ static int perform_file_scan(const char *ast_file, const char *source_file) { if (!printed && prevCursor.kind != CXCursor_InvalidFile) { print_cursor_file_scan(prevCursor, start_line, start_col, - last_line, last_col); + last_line, last_col, prefix); } fclose(fp); @@ -386,7 +391,8 @@ int perform_code_completion(int argc, const char **argv) { static void print_usage(void) { fprintf(stderr, "usage: c-index-test -code-completion-at=<site> <compiler arguments>\n" - " c-index-test -test-file-scan <AST file> <source file>\n" + " c-index-test -test-file-scan <AST file> <source file> " + "[FileCheck prefix]\n" " c-index-test -test-load-tu <AST file> <symbol filter>\n\n" " <symbol filter> options for -test-load-tu:\n%s", " all - load all symbols, including those from PCH\n" @@ -403,8 +409,9 @@ int main(int argc, const char **argv) { return perform_code_completion(argc, argv); if (argc == 4 && strcmp(argv[1], "-test-load-tu") == 0) return perform_test_load_tu(argv[2], argv[3]); - if (argc == 4 && strcmp(argv[1], "-test-file-scan") == 0) - return perform_file_scan(argv[2], argv[3]); + if (argc >= 4 && strcmp(argv[1], "-test-file-scan") == 0) + return perform_file_scan(argv[2], argv[3], + argc >= 5 ? argv[4] : 0); print_usage(); return 1; |