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 | 04c3cf35a80c09ab78e519f2e71ecccd5c5d8da0 (patch) | |
tree | 27d6d2f74752bee780953bb12e77ce2266ce41f4 /tools/c-index-test/c-index-test.c | |
parent | b4954a4175b36d912bdfc43834d09754faddd855 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106459 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.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 4268cec1b2..27c51a0c59 100644 --- a/tools/c-index-test/c-index-test.c +++ b/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; |