aboutsummaryrefslogtreecommitdiff
path: root/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-13 22:52:57 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-13 22:52:57 +0000
commit1f60d9ea523fc321d811fe880ba9a1ec74fa8f9b (patch)
tree0573659048cae0b5bc818e56867a465458899703 /tools/c-index-test/c-index-test.c
parentdacd24775d9654c3fe5dc2a01640c2b2aab2bead (diff)
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
Diffstat (limited to 'tools/c-index-test/c-index-test.c')
-rw-r--r--tools/c-index-test/c-index-test.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 58eff97ef8..305fb40f9b 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -177,9 +177,24 @@ static void PrintCursor(CXCursor Cursor) {
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))