diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-10-16 21:24:31 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-10-16 21:24:31 +0000 |
commit | d3d923a0f2cc85e5e94ab13cd70d231633e3d33c (patch) | |
tree | 08bb8eb57f99c1d90e9172758823050f0169e1cb /clang/tools/c-index-test | |
parent | 007ceb46039daf322651ab02c26fd8993bad2144 (diff) | |
download | bcm5719-llvm-d3d923a0f2cc85e5e94ab13cd70d231633e3d33c.tar.gz bcm5719-llvm-d3d923a0f2cc85e5e94ab13cd70d231633e3d33c.zip |
Make CIndex and c-index-test a little bit more robust. The only
substantive change is that clang_getCursorSource() now returns the
file in which a macro was instantiated when the cursor points into a
macro instantiation, rather than crashing.
llvm-svn: 84275
Diffstat (limited to 'clang/tools/c-index-test')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index bfc8e620ac7..73764950c31 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -63,7 +63,9 @@ static void TranslationUnitVisitor(CXTranslationUnit Unit, CXCursor Cursor, Ref = clang_getCursor(Unit, clang_getCursorSource(Cursor), curLine, curColumn); - if (Ref.kind != CXCursor_FunctionDecl) { + if (Ref.kind == CXCursor_NoDeclFound) { + // Nothing found here; that's fine. + } else if (Ref.kind != CXCursor_FunctionDecl) { printf("// CHECK: %s:%d:%d: ", basename(clang_getCursorSource(Ref)), curLine, curColumn); PrintCursor(Ref); |