aboutsummaryrefslogtreecommitdiff
path: root/tools/c-index-test
diff options
context:
space:
mode:
Diffstat (limited to 'tools/c-index-test')
-rw-r--r--tools/c-index-test/Makefile3
-rw-r--r--tools/c-index-test/c-index-test.c20
2 files changed, 21 insertions, 2 deletions
diff --git a/tools/c-index-test/Makefile b/tools/c-index-test/Makefile
index 03519b3823..b061492caf 100644
--- a/tools/c-index-test/Makefile
+++ b/tools/c-index-test/Makefile
@@ -20,6 +20,7 @@ TOOL_NO_EXPORTS = 1
LINK_COMPONENTS := support mc
USEDLIBS = clang.a clangFrontend.a clangDriver.a \
clangSerialization.a clangParse.a clangSema.a \
- clangAnalysis.a clangEdit.a clangAST.a clangLex.a clangBasic.a
+ clangAnalysis.a clangEdit.a clangAST.a clangLex.a clangComments.a \
+ clangBasic.a
include $(CLANG_LEVEL)/Makefile
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 497c9ee6af..4c9723da01 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -218,7 +218,9 @@ static void PrintCursor(CXCursor Cursor) {
CXPlatformAvailability PlatformAvailability[2];
int NumPlatformAvailability;
int I;
-
+ CXString Comment;
+ const char *CommentCString;
+
ks = clang_getCursorKindSpelling(Cursor.kind);
string = want_display_name? clang_getCursorDisplayName(Cursor)
: clang_getCursorSpelling(Cursor);
@@ -398,6 +400,22 @@ static void PrintCursor(CXCursor Cursor) {
if (!clang_equalRanges(CursorExtent, RefNameRange))
PrintRange(RefNameRange, "RefName");
}
+
+ Comment = clang_Cursor_getRawCommentText(Cursor);
+ CommentCString = clang_getCString(Comment);
+ if (CommentCString != NULL && CommentCString[0] != '\0') {
+ printf(" Comment=[");
+ for ( ; *CommentCString; ++CommentCString) {
+ if (*CommentCString != '\n')
+ putchar(*CommentCString);
+ else
+ printf("\\n");
+ }
+ printf("]");
+
+ PrintRange(clang_Cursor_getCommentRange(Cursor), "CommentRange");
+ }
+ clang_disposeString(Comment);
}
}