12e5b6d6dSopenharmony_ci// Copyright (C) 2016 and later: Unicode, Inc. and others. 22e5b6d6dSopenharmony_ci// License & terms of use: http://www.unicode.org/copyright.html 32e5b6d6dSopenharmony_ci/* Copyright (C) 2012 IBM Corporation and Others. All Rights Reserved */ 42e5b6d6dSopenharmony_ci 52e5b6d6dSopenharmony_ci#include <stdio.h> 62e5b6d6dSopenharmony_ci#include <demangle.h> 72e5b6d6dSopenharmony_ci 82e5b6d6dSopenharmony_civoid showSym(char *str) { 92e5b6d6dSopenharmony_ci char *rest; 102e5b6d6dSopenharmony_ci struct Name *name = Demangle(str, rest); // "f__1XFi" 112e5b6d6dSopenharmony_ci 122e5b6d6dSopenharmony_ci printf("# '%s'\n", str); 132e5b6d6dSopenharmony_ci if(*rest) printf("\trest: '%s'\n", rest); 142e5b6d6dSopenharmony_ci if(name->Kind() == MemberFunction) { 152e5b6d6dSopenharmony_ci //((MemberFunctionName *) name)->Scope()->Text() is "X" 162e5b6d6dSopenharmony_ci //((MemberFunctionName *) name)->RootName() is "f" 172e5b6d6dSopenharmony_ci //((MemberFunctionName *) name)->Text() is "X::f(int)" 182e5b6d6dSopenharmony_ci printf("\t=> %s\n", ((MemberFunctionName *) name)->Text()); 192e5b6d6dSopenharmony_ci } else { 202e5b6d6dSopenharmony_ci printf("\t(not MemberFunction)\n"); 212e5b6d6dSopenharmony_ci } 222e5b6d6dSopenharmony_ci} 232e5b6d6dSopenharmony_ci 242e5b6d6dSopenharmony_ci 252e5b6d6dSopenharmony_ci 262e5b6d6dSopenharmony_ci 272e5b6d6dSopenharmony_ci 282e5b6d6dSopenharmony_ciint main(int argc, /*const*/ char *argv[]) { 292e5b6d6dSopenharmony_ci if(argc>1) { 302e5b6d6dSopenharmony_ci for(int i=1;i<argc;i++) { 312e5b6d6dSopenharmony_ci showSym(argv[i]); 322e5b6d6dSopenharmony_ci } 332e5b6d6dSopenharmony_ci } else { 342e5b6d6dSopenharmony_ci printf("Usage: %s <symbol> ...\n", argv[0]); 352e5b6d6dSopenharmony_ci } 362e5b6d6dSopenharmony_ci 372e5b6d6dSopenharmony_ci 382e5b6d6dSopenharmony_ci 392e5b6d6dSopenharmony_ci} 40