- 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
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 101d712..e7043c1 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 @@
     /* 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);