Split clang_getCursor() into clang_getCursor() and clang_getCursorWithHint().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84873 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index e6e63b8..cbc3085 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -695,13 +695,26 @@
 //
 // CXCursor Operations.
 //
+void clang_initCXLookupHint(CXLookupHint *hint) {
+  memset(hint, 0, sizeof(*hint));
+}
+
 CXCursor clang_getCursor(CXTranslationUnit CTUnit, const char *source_name, 
-                         unsigned line, unsigned column, 
-                         CXDecl RelativeToDecl)
+                         unsigned line, unsigned column) {
+  return clang_getCursorWithHint(CTUnit, source_name, line, column, NULL);
+}
+  
+CXCursor clang_getCursorWithHint(CXTranslationUnit CTUnit,
+                                 const char *source_name, 
+                                 unsigned line, unsigned column, 
+                                 CXLookupHint *hint)
 {
   assert(CTUnit && "Passed null CXTranslationUnit");
   ASTUnit *CXXUnit = static_cast<ASTUnit *>(CTUnit);
   
+  // FIXME: Make this better.
+  CXDecl RelativeToDecl = hint ? hint->decl : NULL;
+  
   FileManager &FMgr = CXXUnit->getFileManager();
   const FileEntry *File = FMgr.getFile(source_name, 
                                        source_name+strlen(source_name));  
diff --git a/tools/CIndex/CIndex.exports b/tools/CIndex/CIndex.exports
index ea647b4..e9d44a0 100644
--- a/tools/CIndex/CIndex.exports
+++ b/tools/CIndex/CIndex.exports
@@ -7,6 +7,7 @@
 _clang_getCursorKind
 _clang_getCursorLine
 _clang_getCursorSource
+_clang_getCursorWithHint
 _clang_getDeclarationName
 _clang_getDeclSpelling
 _clang_getDeclLine
@@ -20,6 +21,7 @@
 _clang_createTranslationUnit
 _clang_createTranslationUnitFromSourceFile
 _clang_disposeTranslationUnit
+_clang_initCXLookupHint
 _clang_isDeclaration
 _clang_isReference
 _clang_isDefinition
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index b458216..5cbc2fa 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -60,9 +60,13 @@
             curColumn = 1;
           } else if (*startBuf != '\t')
             curColumn++;
+          
+          CXLookupHint hint;
+          clang_initCXLookupHint(&hint);
+          hint.decl = Cursor.decl;
 
-          Ref = clang_getCursor(Unit, clang_getCursorSource(Cursor),
-                                curLine, curColumn, Cursor.decl);
+          Ref = clang_getCursorWithHint(Unit, clang_getCursorSource(Cursor),
+                                        curLine, curColumn, &hint);
           if (Ref.kind == CXCursor_NoDeclFound) {
             /* Nothing found here; that's fine. */
           } else if (Ref.kind != CXCursor_FunctionDecl) {