diff options
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index d7c28dd..56e4101 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -796,15 +796,42 @@ static void PrintCursor(CXCursor Cursor, const char *CommentSchemaFile) { printf(" [access=%s isVirtual=%s]", accessStr, isVirtual ? "true" : "false"); } - + SpecializationOf = clang_getSpecializedCursorTemplate(Cursor); if (!clang_equalCursors(SpecializationOf, clang_getNullCursor())) { CXSourceLocation Loc = clang_getCursorLocation(SpecializationOf); CXString Name = clang_getCursorSpelling(SpecializationOf); clang_getSpellingLocation(Loc, 0, &line, &column, 0); - printf(" [Specialization of %s:%d:%d]", + printf(" [Specialization of %s:%d:%d]", clang_getCString(Name), line, column); clang_disposeString(Name); + + if (Cursor.kind == CXCursor_FunctionDecl) { + /* Collect the template parameter kinds from the base template. */ + unsigned NumTemplateArgs = clang_Cursor_getNumTemplateArguments(Cursor); + unsigned I; + for (I = 0; I < NumTemplateArgs; I++) { + enum CXTemplateArgumentKind TAK = + clang_Cursor_getTemplateArgumentKind(Cursor, I); + switch(TAK) { + case CXTemplateArgumentKind_Type: + { + CXType T = clang_Cursor_getTemplateArgumentType(Cursor, I); + CXString S = clang_getTypeSpelling(T); + printf(" [Template arg %d: kind: %d, type: %s]", + I, TAK, clang_getCString(S)); + clang_disposeString(S); + } + break; + case CXTemplateArgumentKind_Integral: + printf(" [Template arg %d: kind: %d, intval: %lld]", + I, TAK, clang_Cursor_getTemplateArgumentValue(Cursor, I)); + break; + default: + printf(" [Template arg %d: kind: %d]\n", I, TAK); + } + } + } } clang_getOverriddenCursors(Cursor, &overridden, &num_overridden); |