aboutsummaryrefslogtreecommitdiff
path: root/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-04-11 19:32:19 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-04-11 19:32:19 +0000
commitd98ef9ae48ab4090d4d5d703ce65cfac62807fda (patch)
tree10f93d77fa3dec4dc2bef3c008d440205485da6b /tools/c-index-test/c-index-test.c
parenteba8cd5967e47592285590360bde73063c9c226f (diff)
[libclang] Introduce a couple of functions to make it convenient
to get at the parameters (and their types) of a function or objc method cursor. int clang_Cursor_getNumArguments(CXCursor C); CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i); rdar://11201527 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154523 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.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index f82d2d2820..3dfc732d2b 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -663,6 +663,22 @@ static enum CXChildVisitResult PrintTypeKind(CXCursor cursor, CXCursor p,
clang_disposeString(RS);
}
}
+ /* Print the argument types if they exist. */
+ {
+ int numArgs = clang_Cursor_getNumArguments(cursor);
+ if (numArgs != -1 && numArgs != 0) {
+ printf(" [args=");
+ for (int i = 0; i < numArgs; ++i) {
+ CXType T = clang_getCursorType(clang_Cursor_getArgument(cursor, i));
+ if (T.kind != CXType_Invalid) {
+ CXString S = clang_getTypeKindSpelling(T.kind);
+ printf(" %s", clang_getCString(S));
+ clang_disposeString(S);
+ }
+ }
+ printf("]");
+ }
+ }
/* Print if this is a non-POD type. */
printf(" [isPOD=%d]", clang_isPODType(T));