aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-10-20 22:00:55 +0000
committerDouglas Gregor <dgregor@apple.com>2010-10-20 22:00:55 +0000
commit796d76a663795d66ed5aa97a1f585514dd68b043 (patch)
tree98f71284a72e7f7714726b6ac5058e61dc56d97d /clang/tools/c-index-test/c-index-test.c
parent2edaa2fb24eb17fbb6b3752ddb7d06a8d6b0799e (diff)
downloadllvm-796d76a663795d66ed5aa97a1f585514dd68b043.zip
llvm-796d76a663795d66ed5aa97a1f585514dd68b043.tar.gz
llvm-796d76a663795d66ed5aa97a1f585514dd68b043.tar.bz2
Extend the preprocessing record and libclang with support for
inclusion directives, keeping track of every #include, #import, etc. in the translation unit. We keep track of the source location and kind of the inclusion, how the file name was spelled, and the underlying file to which the inclusion resolved. llvm-svn: 116952
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r--clang/tools/c-index-test/c-index-test.c7
1 files changed, 7 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 32cada0..c95fb30 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -271,6 +271,13 @@ static void PrintCursor(CXCursor Cursor) {
printf("]");
clang_disposeOverriddenCursors(overridden);
}
+
+ if (Cursor.kind == CXCursor_InclusionDirective) {
+ CXFile File = clang_getIncludedFile(Cursor);
+ CXString Included = clang_getFileName(File);
+ printf(" (%s)", clang_getCString(Included));
+ clang_disposeString(Included);
+ }
}
}