aboutsummaryrefslogtreecommitdiff
path: root/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-16 21:24:31 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-16 21:24:31 +0000
commit02465750c8c3fa96b1e7e596b02297e24361dc4f (patch)
treef19ba5854fcc04c0c11b59550fcb8120e809bb81 /tools/c-index-test/c-index-test.c
parentb5deae519b1f86d514427c412d9f8873d93c909c (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84275 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.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index bfc8e620ac..73764950c3 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/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);