aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2014-02-27 16:05:05 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2014-02-27 16:05:05 +0000
commit6ede6aba287269a369486b094710bb8cc916e54f (patch)
treeff566aa158c88cb5f5095806b8acfbb8430518b6 /clang/tools/c-index-test/c-index-test.c
parentd8c2fbd57fdd003b8960975757ab996fb2196a84 (diff)
downloadllvm-6ede6aba287269a369486b094710bb8cc916e54f.zip
llvm-6ede6aba287269a369486b094710bb8cc916e54f.tar.gz
llvm-6ede6aba287269a369486b094710bb8cc916e54f.tar.bz2
libclang: New functions clang_Type_getNumTemplateArguments,
clang_Type_getTemplateArgument Note that these functions don't handle variadic templates -- see tests. Patch by Matthieu Nottale and Philippe Daouadi. llvm-svn: 202406
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r--clang/tools/c-index-test/c-index-test.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index 3a47ae4..defc916 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -1263,11 +1263,11 @@ static enum CXChildVisitResult PrintType(CXCursor cursor, CXCursor p,
}
/* Print the argument types if they exist. */
{
- int numArgs = clang_Cursor_getNumArguments(cursor);
- if (numArgs != -1 && numArgs != 0) {
+ int NumArgs = clang_Cursor_getNumArguments(cursor);
+ if (NumArgs != -1 && NumArgs != 0) {
int i;
printf(" [args=");
- for (i = 0; i < numArgs; ++i) {
+ for (i = 0; i < NumArgs; ++i) {
CXType T = clang_getCursorType(clang_Cursor_getArgument(cursor, i));
if (T.kind != CXType_Invalid) {
PrintTypeAndTypeKind(T, " [%s] [%s]");
@@ -1276,6 +1276,21 @@ static enum CXChildVisitResult PrintType(CXCursor cursor, CXCursor p,
printf("]");
}
}
+ /* Print the template argument types if they exist. */
+ {
+ int NumTArgs = clang_Type_getNumTemplateArguments(T);
+ if (NumTArgs != -1 && NumTArgs != 0) {
+ int i;
+ printf(" [templateargs/%d=", NumTArgs);
+ for (i = 0; i < NumTArgs; ++i) {
+ CXType TArg = clang_Type_getTemplateArgumentAsType(T, i);
+ if (TArg.kind != CXType_Invalid) {
+ PrintTypeAndTypeKind(TArg, " [type=%s] [typekind=%s]");
+ }
+ }
+ printf("]");
+ }
+ }
/* Print if this is a non-POD type. */
printf(" [isPOD=%d]", clang_isPODType(T));