diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-09-13 22:52:57 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-09-13 22:52:57 +0000 |
commit | 16a2bdd6b011e4522463ae162625712f1764cb1c (patch) | |
tree | f60b6dc514026a6dc27ab1f9460cb6e891cc118c /clang/tools/c-index-test/c-index-test.c | |
parent | 59c97b50ae56b69d42cdecd94818ef0c1e317393 (diff) | |
download | llvm-16a2bdd6b011e4522463ae162625712f1764cb1c.zip llvm-16a2bdd6b011e4522463ae162625712f1764cb1c.tar.gz llvm-16a2bdd6b011e4522463ae162625712f1764cb1c.tar.bz2 |
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.
llvm-svn: 113805
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 58eff97..305fb40f 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/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)) |