summaryrefslogtreecommitdiffstats
path: root/clang/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2015-11-12 03:57:22 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2015-11-12 03:57:22 +0000
commit6003443b8e04407d5497301b1cd9b3511b9b4343 (patch)
tree534cb6c28e1c11b8cc8d3b1fbe4ddaaaa8588a72 /clang/tools/c-index-test/c-index-test.c
parent5d92eaeb17f9b3b384a9d62036ee9d81134d2762 (diff)
downloadbcm5719-llvm-6003443b8e04407d5497301b1cd9b3511b9b4343.tar.gz
bcm5719-llvm-6003443b8e04407d5497301b1cd9b3511b9b4343.zip
libclang: add clang_Cursor_getCXXManglings
This function permits the mangling of a C++ 'structor. Depending on the ABI and the declaration, the declaration may contain more than one associated symbol for a given declaration. This allows the consumer to retrieve all of the associated symbols for the declaration the cursor points to. llvm-svn: 252853
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r--clang/tools/c-index-test/c-index-test.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index 26ef5f204b6..8181642d71b 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -1441,6 +1441,25 @@ static enum CXChildVisitResult PrintMangledName(CXCursor cursor, CXCursor p,
return CXChildVisit_Continue;
}
+static enum CXChildVisitResult PrintManglings(CXCursor cursor, CXCursor p,
+ CXClientData d) {
+ unsigned I, E;
+ CXStringSet *Manglings = NULL;
+ if (clang_isUnexposed(clang_getCursorKind(cursor)))
+ return CXChildVisit_Recurse;
+ if (!clang_isDeclaration(clang_getCursorKind(cursor)))
+ return CXChildVisit_Recurse;
+ if (clang_getCursorKind(cursor) == CXCursor_ParmDecl)
+ return CXChildVisit_Continue;
+ PrintCursor(cursor, NULL);
+ Manglings = clang_Cursor_getCXXManglings(cursor);
+ for (I = 0, E = Manglings->Count; I < E; ++I)
+ printf(" [mangled=%s]", clang_getCString(Manglings->Strings[I]));
+ clang_disposeStringSet(Manglings);
+ printf("\n");
+ return CXChildVisit_Recurse;
+}
+
/******************************************************************************/
/* Bitwidth testing. */
/******************************************************************************/
@@ -4163,6 +4182,8 @@ int cindextest_main(int argc, const char **argv) {
PrintBitWidth, 0);
else if (argc > 2 && strcmp(argv[1], "-test-print-mangle") == 0)
return perform_test_load_tu(argv[2], "all", NULL, PrintMangledName, NULL);
+ else if (argc > 2 && strcmp(argv[1], "-test-print-manglings") == 0)
+ return perform_test_load_tu(argv[2], "all", NULL, PrintManglings, NULL);
else if (argc > 1 && strcmp(argv[1], "-print-usr") == 0) {
if (argc > 2)
return print_usrs(argv + 2, argv + argc);
OpenPOWER on IntegriCloud