Introduce a new kind of cursor into libclang, which covers a reference
to an "overloaded" set of declarations. This cursor kind works for
unresolved references to functions/templates (e.g., a call within a
template), using declarations, and Objective-C class and protocol
forward declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113805 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 58eff97..305fb40 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -177,9 +177,24 @@
 
     Referenced = clang_getCursorReferenced(Cursor);
     if (!clang_equalCursors(Referenced, clang_getNullCursor())) {
-      CXSourceLocation Loc = clang_getCursorLocation(Referenced);
-      clang_getInstantiationLocation(Loc, 0, &line, &column, 0);
-      printf(":%d:%d", line, column);
+      if (clang_getCursorKind(Referenced) == CXCursor_OverloadedDeclRef) {
+        unsigned I, N = clang_getNumOverloadedDecls(Referenced);
+        printf("[");
+        for (I = 0; I != N; ++I) {
+          CXCursor Ovl = clang_getOverloadedDecl(Referenced, I);
+          if (I)
+            printf(", ");
+          
+          CXSourceLocation Loc = clang_getCursorLocation(Ovl);
+          clang_getInstantiationLocation(Loc, 0, &line, &column, 0);
+          printf("%d:%d", line, column);          
+        }
+        printf("]");
+      } else {
+        CXSourceLocation Loc = clang_getCursorLocation(Referenced);
+        clang_getInstantiationLocation(Loc, 0, &line, &column, 0);
+        printf(":%d:%d", line, column);
+      }
     }
 
     if (clang_isCursorDefinition(Cursor))