summaryrefslogtreecommitdiffstats
path: root/clang/tools/c-index-test
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-12-05 08:19:32 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-12-05 08:19:32 +0000
commit9ef5775a949d2c78ba01169d0eca962f5d7c1ae7 (patch)
treeb5449b4ac390544b73b20cb0b3864dab91a40150 /clang/tools/c-index-test
parent011e6a5f44f7085279da2afde76f7041825b8b88 (diff)
downloadbcm5719-llvm-9ef5775a949d2c78ba01169d0eca962f5d7c1ae7.tar.gz
bcm5719-llvm-9ef5775a949d2c78ba01169d0eca962f5d7c1ae7.zip
[libclang] Record ranges skipped by the preprocessor and expose them with libclang.
Patch by Erik Verbruggen! llvm-svn: 196487
Diffstat (limited to 'clang/tools/c-index-test')
-rw-r--r--clang/tools/c-index-test/c-index-test.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index 58eb0def3e3..40794308065 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -3183,6 +3183,7 @@ int perform_token_annotation(int argc, const char **argv) {
CXSourceLocation startLoc, endLoc;
CXFile file = 0;
CXCursor *cursors = 0;
+ CXSkippedRanges *skipped_ranges = 0;
unsigned i;
input += strlen("-test-annotate-tokens=");
@@ -3271,6 +3272,19 @@ int perform_token_annotation(int argc, const char **argv) {
goto teardown;
}
+ skipped_ranges = clang_getSkippedRanges(TU, file);
+ for (i = 0; i != skipped_ranges->count; ++i) {
+ unsigned start_line, start_column, end_line, end_column;
+ clang_getSpellingLocation(clang_getRangeStart(skipped_ranges->ranges[i]),
+ 0, &start_line, &start_column, 0);
+ clang_getSpellingLocation(clang_getRangeEnd(skipped_ranges->ranges[i]),
+ 0, &end_line, &end_column, 0);
+ printf("Skipping: ");
+ PrintExtent(stdout, start_line, start_column, end_line, end_column);
+ printf("\n");
+ }
+ clang_disposeSkippedRanges(skipped_ranges);
+
for (i = 0; i != num_tokens; ++i) {
const char *kind = "<unknown>";
CXString spelling = clang_getTokenSpelling(TU, tokens[i]);
OpenPOWER on IntegriCloud