diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-09-02 00:07:54 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-09-02 00:07:54 +0000 |
commit | d3f48bd3be9642d7e05eab32b5180ea01b00ed26 (patch) | |
tree | 614f21537fcf299bbd61c20d1e1e568ff9adc6f8 /clang/tools/c-index-test/c-index-test.c | |
parent | 6f2067659d83b64f27c5e53541877ea23a3669d0 (diff) | |
download | bcm5719-llvm-d3f48bd3be9642d7e05eab32b5180ea01b00ed26.tar.gz bcm5719-llvm-d3f48bd3be9642d7e05eab32b5180ea01b00ed26.zip |
Introduce a new libclang function,
clang_getSpecializedCursorTemplate(), which determines the template
(or member thereof) that the given cursor specializes or from which it
was instantiated. This routine can be used to establish a link between
templates and their instantiations/specializations.
llvm-svn: 112780
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index cdf0cd06b5c..58eff97ef8f 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -166,7 +166,8 @@ static void PrintCursor(CXCursor Cursor) { CXString string, ks; CXCursor Referenced; unsigned line, column; - + CXCursor SpecializationOf; + ks = clang_getCursorKindSpelling(Cursor.kind); string = clang_getCursorSpelling(Cursor); printf("%s=%s", clang_getCString(ks), @@ -224,6 +225,16 @@ static void PrintCursor(CXCursor Cursor) { printf(" [access=%s isVirtual=%s]", accessStr, isVirtual ? "true" : "false"); } + + SpecializationOf = clang_getSpecializedCursorTemplate(Cursor); + if (!clang_equalCursors(SpecializationOf, clang_getNullCursor())) { + CXSourceLocation Loc = clang_getCursorLocation(SpecializationOf); + CXString Name = clang_getCursorSpelling(SpecializationOf); + clang_getInstantiationLocation(Loc, 0, &line, &column, 0); + printf(" [Specialization of %s:%d:%d]", + clang_getCString(Name), line, column); + clang_disposeString(Name); + } } } |