howto demangle const types?
Larry Evans
cppljevans@suddenlink.net
Wed Feb 2 22:39:00 GMT 2011
The attached code produces output:
int const=int
IOW, the abi::__cxa_demangle strips const qualifiers.
Looking at:
http://gcc.gnu.org/viewcvs/trunk/libiberty/cp-demangle.h?view=markup
shows:
99 /* The options passed to the demangler. */
...
165 extern void
166 cplus_demangle_init_info (const char *, int, size_t, struct d_info *);
and the following:
http://gcc.gnu.org/viewcvs/trunk/libiberty/cp-demangle.c?revision=166810&view=markup
shows:
1129 if (dc != NULL && top_level && (di->options & DMGL_PARAMS) == 0)
1130 {
1131 /* Strip off any initial CV-qualifiers, as they really apply
1132 to the `this' parameter, and they were not output by the
1133 v2 demangler without DMGL_PARAMS. */
so maybe I just need to pass the proper di->options to some function,
probably the one mentioned here:
43 This file will normally define the following functions, q.v.:
44 char *cplus_demangle_v3(const char *mangled, int options)
However, the only documentation of options in this file are:
4865 /* Entry point for the demangler. If MANGLED is a g++ v3 ABI mangled
4866 name, return a buffer allocated with malloc holding the demangled
4867 name. OPTIONS is the usual libiberty demangler options. On
4868 success, this sets *PALC to the allocated size of the returned
4869 buffer. On failure, this sets *PALC to 0 for a bad name, or 1 for
4870 a memory allocation failure, and returns NULL. */
4871
4872 static char *
4873 d_demangle (const char *mangled, int options, size_t *palc)
However, there's no link to where these "usual libiberty demangler
options" are described.
Also, how can I allow the linker to find cplus_demangle_v3?
TIA.
-Larry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: demangle_const.cpp
Type: text/x-c++src
Size: 947 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20110202/2b0797bb/attachment.bin>
More information about the Gcc-help
mailing list