diff options
author | Steve Naroff <snaroff@apple.com> | 2009-09-15 20:25:34 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-09-15 20:25:34 +0000 |
commit | 77128ddd3077fc045751a55bb3226802b15d5510 (patch) | |
tree | 1c3b342c0ce5cf90fba48540b61e389d83bdeede /tools/c-index-test/c-index-test.c | |
parent | 1fdd89ba1d14ee11fda5b9e1c171db428b1acb23 (diff) |
- clang_getCursor(): Replace asserts with error codes (CXCursor_InvalidFile, CXCursor_NoDeclFound).
- Add predicate clang_isInvalid().
- Implement clang_getCursorFromDecl().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81908 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 | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 101d71223a..e7043c1482 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -5,8 +5,11 @@ #include <string.h> static void PrintCursor(CXCursor Cursor) { - printf("%s => %s ", clang_getCursorKindSpelling(Cursor.kind), - clang_getCursorSpelling(Cursor)); + if (clang_isInvalid(Cursor.kind)) + printf("Invalid Cursor => %s\n", clang_getCursorKindSpelling(Cursor.kind)); + else + printf("%s => %s ", clang_getCursorKindSpelling(Cursor.kind), + clang_getCursorSpelling(Cursor)); } static void DeclVisitor(CXDecl Dcl, CXCursor Cursor, CXClientData Filter) @@ -47,8 +50,10 @@ int main(int argc, char **argv) { /* methodSignature - returns a cursor of type ObjCInstanceMethodDecl */ C = clang_getCursor(TU, "/System/Library/Frameworks/Foundation.framework/Headers/NSInvocation.h", 22, 1); PrintCursor(C); + C = clang_getCursor(TU, "Large.m", 5, 18); + PrintCursor(C); } else if (argc == 3) { - enum CXCursorKind K = CXCursor_Invalid; + enum CXCursorKind K = CXCursor_NotImplemented; if (!strcmp(argv[2], "all")) { clang_loadTranslationUnit(TU, TranslationUnitVisitor, 0); |