diff options
author | Sergey Kalinichev <kalinichev.so.0@gmail.com> | 2016-01-07 09:20:40 +0000 |
---|---|---|
committer | Sergey Kalinichev <kalinichev.so.0@gmail.com> | 2016-01-07 09:20:40 +0000 |
commit | b8d516a8d9d2d94dbbcf8ce3eacda0ace287987d (patch) | |
tree | 4bff19a4560761fc170108b89ae8540e47cb786f /clang/tools/c-index-test | |
parent | 490b7f8b6d28a7fa90efc7dae138f6c6e9981ab5 (diff) | |
download | bcm5719-llvm-b8d516a8d9d2d94dbbcf8ce3eacda0ace287987d.tar.gz bcm5719-llvm-b8d516a8d9d2d94dbbcf8ce3eacda0ace287987d.zip |
[libclang] Handle AutoType in clang_getTypeDeclaration
Differential Revision: http://reviews.llvm.org/D13001
llvm-svn: 257043
Diffstat (limited to 'clang/tools/c-index-test')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 20 |
1 files changed, 20 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 8336491c015..2a6002537ec 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -1508,6 +1508,22 @@ static enum CXChildVisitResult PrintBitWidth(CXCursor cursor, CXCursor p, } /******************************************************************************/ +/* Type declaration testing */ +/******************************************************************************/ + +static enum CXChildVisitResult PrintTypeDeclaration(CXCursor cursor, CXCursor p, + CXClientData d) { + CXCursor typeDeclaration = clang_getTypeDeclaration(clang_getCursorType(cursor)); + + if (clang_isDeclaration(typeDeclaration.kind)) { + PrintCursor(cursor, NULL); + PrintTypeAndTypeKind(clang_getCursorType(typeDeclaration), " [typedeclaration=%s] [typekind=%s]\n"); + } + + return CXChildVisit_Recurse; +} + +/******************************************************************************/ /* Loading ASTs/source. */ /******************************************************************************/ @@ -4137,6 +4153,7 @@ static void print_usage(void) { " c-index-test -test-print-type {<args>}*\n" " c-index-test -test-print-type-size {<args>}*\n" " c-index-test -test-print-bitwidth {<args>}*\n" + " c-index-test -test-print-type-declaration {<args>}*\n" " c-index-test -print-usr [<CursorKind> {<args>}]*\n" " c-index-test -print-usr-file <file>\n" " c-index-test -write-pch <file> <compiler arguments>\n"); @@ -4230,6 +4247,9 @@ int cindextest_main(int argc, const char **argv) { else if (argc > 2 && strcmp(argv[1], "-test-print-type-size") == 0) return perform_test_load_source(argc - 2, argv + 2, "all", PrintTypeSize, 0); + else if (argc > 2 && strcmp(argv[1], "-test-print-type-declaration") == 0) + return perform_test_load_source(argc - 2, argv + 2, "all", + PrintTypeDeclaration, 0); else if (argc > 2 && strcmp(argv[1], "-test-print-bitwidth") == 0) return perform_test_load_source(argc - 2, argv + 2, "all", PrintBitWidth, 0); |