diff options
author | Steve Naroff <snaroff@apple.com> | 2009-10-21 13:56:23 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-10-21 13:56:23 +0000 |
commit | 20bad0b7c65bb74adc64d31ef76dcc12ff4d6737 (patch) | |
tree | 8df7876b0c1b4feecc371c0919afcba99acc3415 /clang/tools/c-index-test/c-index-test.c | |
parent | 45f99d662157a9c41445355b5494bce3acf31b46 (diff) | |
download | bcm5719-llvm-20bad0b7c65bb74adc64d31ef76dcc12ff4d6737.tar.gz bcm5719-llvm-20bad0b7c65bb74adc64d31ef76dcc12ff4d6737.zip |
Extend clang_getCursor() to take a 'relativeDecl' argument (so speed up searching). Without a 'relativeDecl', the algorithm is n-squared. For example, running the following command on 'Large.m' takes hours without a 'relatvieDecl'.
snaroff% time ../../Debug/bin/c-index-test Large.ast all > Large.out
snaroff% cat Large.m
#import <Cocoa/Cocoa.h>
#import <QuickTime/QuickTime.h>
#import <OpenGL/OpenGL.h>
With a 'relativeDecl', it takes <30 seconds:-)
llvm-svn: 84760
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 83d3d3f3138..b458216f70d 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -53,7 +53,7 @@ static void TranslationUnitVisitor(CXTranslationUnit Unit, CXCursor Cursor, unsigned curLine = startLine, curColumn = startColumn; CXCursor Ref; - while (startBuf <= endBuf) { + while (startBuf < endBuf) { if (*startBuf == '\n') { startBuf++; curLine++; @@ -62,7 +62,7 @@ static void TranslationUnitVisitor(CXTranslationUnit Unit, CXCursor Cursor, curColumn++; Ref = clang_getCursor(Unit, clang_getCursorSource(Cursor), - curLine, curColumn); + curLine, curColumn, Cursor.decl); if (Ref.kind == CXCursor_NoDeclFound) { /* Nothing found here; that's fine. */ } else if (Ref.kind != CXCursor_FunctionDecl) { |