aboutsummaryrefslogtreecommitdiff
path: root/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-10-01 20:25:15 +0000
committerDouglas Gregor <dgregor@apple.com>2010-10-01 20:25:15 +0000
commit9f59234a91d057cee7c5e3cee91da8696858c692 (patch)
treece4c9360fcfc49888cf2c5f5c04f140bef643cc4 /tools/c-index-test/c-index-test.c
parentdc928191a33be17f3b921c0616e6463312f439db (diff)
Extend libclang with an API that determines, given a C++ virtual
member function or an Objective-C method, which other member functions/methods it overrides. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115338 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.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 874c73282c..f83162295d 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -167,7 +167,9 @@ static void PrintCursor(CXCursor Cursor) {
CXCursor Referenced;
unsigned line, column;
CXCursor SpecializationOf;
-
+ CXCursor *overridden;
+ unsigned num_overridden;
+
ks = clang_getCursorKindSpelling(Cursor.kind);
string = clang_getCursorSpelling(Cursor);
printf("%s=%s", clang_getCString(ks),
@@ -251,6 +253,21 @@ static void PrintCursor(CXCursor Cursor) {
clang_getCString(Name), line, column);
clang_disposeString(Name);
}
+
+ clang_getOverriddenCursors(Cursor, &overridden, &num_overridden);
+ if (num_overridden) {
+ unsigned I;
+ printf(" [Overrides ");
+ for (I = 0; I != num_overridden; ++I) {
+ CXSourceLocation Loc = clang_getCursorLocation(overridden[I]);
+ clang_getInstantiationLocation(Loc, 0, &line, &column, 0);
+ if (I)
+ printf(", ");
+ printf("@%d:%d", line, column);
+ }
+ printf("]");
+ clang_disposeOverriddenCursors(overridden);
+ }
}
}