diff options
author | Steve Naroff <snaroff@apple.com> | 2009-09-04 15:44:05 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-09-04 15:44:05 +0000 |
commit | ef9618b75f64a704d02534cd1f13ce3d97502e18 (patch) | |
tree | 8d273d9426f79db293c5b4bb791ecc726cc877de /clang/tools/c-index-test | |
parent | 2d2282e8f919f152ba71a19ac037b636b8d89683 (diff) | |
download | bcm5719-llvm-ef9618b75f64a704d02534cd1f13ce3d97502e18.tar.gz bcm5719-llvm-ef9618b75f64a704d02534cd1f13ce3d97502e18.zip |
Implement accessors clang_getCursorKind(), clang_getCursorDecl().
Implement clang_getCursor() - wired up to Argiris's work.
Implement callbacks for CXCursor_ObjCProtocolRef.
llvm-svn: 81004
Diffstat (limited to 'clang/tools/c-index-test')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index dbf31bea5a9..6db4898b086 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -39,12 +39,21 @@ static void TranslationUnitVisitor(CXTranslationUnit Unit, CXCursor Cursor, int main(int argc, char **argv) { CXIndex Idx = clang_createIndex(); CXTranslationUnit TU = clang_createTranslationUnit(Idx, argv[1]); - - if (argc == 2) - clang_loadTranslationUnit(TU, TranslationUnitVisitor, 0); - else if (argc == 3) { + + if (argc == 2) { + /* malloc - returns a cursor of type CXCursor_FunctionDecl */ + CXCursor C = clang_getCursor(TU, "/usr/include/stdlib.h", 169, 7); + PrintCursor(C); + /* methodSignature - returns a cursor of type ObjCInstanceMethodDecl */ + C = clang_getCursor(TU, "/System/Library/Frameworks/Foundation.framework/Headers/NSInvocation.h", 22, 1); + PrintCursor(C); + } else if (argc == 3) { enum CXCursorKind K = CXCursor_Invalid; + if (!strcmp(argv[2], "all")) { + clang_loadTranslationUnit(TU, TranslationUnitVisitor, 0); + return 1; + } if (!strcmp(argv[2], "category")) K = CXCursor_ObjCCategoryDecl; else if (!strcmp(argv[2], "interface")) K = CXCursor_ObjCInterfaceDecl; else if (!strcmp(argv[2], "protocol")) K = CXCursor_ObjCProtocolDecl; |