diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-06-21 20:15:39 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-06-21 20:15:39 +0000 |
commit | c150887fef308647b25178499e475a331587ce78 (patch) | |
tree | ab70013a082ab8f383c14038f92bd16119eda725 /clang/tools/c-index-test | |
parent | 79404afc1c9a6b4c498bb28c6cb0aad23783de9d (diff) | |
download | bcm5719-llvm-c150887fef308647b25178499e475a331587ce78.tar.gz bcm5719-llvm-c150887fef308647b25178499e475a331587ce78.zip |
Add CXType support for FunctionNoProto and FunctionProto types. This includes adding a new
function, clang_getResultType(), which returns the result type of the function type.
llvm-svn: 106459
Diffstat (limited to 'clang/tools/c-index-test')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 4268cec1b23..27c51a0c596 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -455,16 +455,29 @@ static enum CXChildVisitResult PrintTypeKind(CXCursor cursor, CXCursor p, if (!clang_isInvalid(clang_getCursorKind(cursor))) { CXType T = clang_getCursorType(cursor); - CXType CT = clang_getCanonicalType(T); CXString S = clang_getTypeKindSpelling(T.kind); PrintCursor(cursor); printf(" typekind=%s", clang_getCString(S)); - if (!clang_equalTypes(T, CT)) { - CXString CS = clang_getTypeKindSpelling(CT.kind); - printf(" [canonical=%s]", clang_getCString(CS)); - clang_disposeString(CS); - } clang_disposeString(S); + // Print the canonical type if it is different. + { + CXType CT = clang_getCanonicalType(T); + if (!clang_equalTypes(T, CT)) { + CXString CS = clang_getTypeKindSpelling(CT.kind); + printf(" [canonical=%s]", clang_getCString(CS)); + clang_disposeString(CS); + } + } + // Print the return type if it exists. + { + CXType RT = clang_getResultType(T); + if (RT.kind != CXType_Invalid) { + CXString RS = clang_getTypeKindSpelling(RT.kind); + printf(" [result=%s]", clang_getCString(RS)); + clang_disposeString(RS); + } + } + printf("\n"); } return CXChildVisit_Recurse; |