Boost logo

Boost :

Subject: Re: [boost] [core] Detach demangle() from type_info
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-06-06 16:06:47


On Friday 06 June 2014 22:56:41 Peter Dimov wrote:
> Andrey Semashev wrote:
> > Hi Peter,
> >
> > I can see you already extracted demangle() to boost/core. Great, thanks!
> >
> > However I'd prefer it to be detached from type_info. This tool would be
> > useful with different kinds of symbols, like function and variable names,
> > not just type_info. So it better accept a string as an argument and not
> > type_info. demangled_name() should probably be in core/typeinfo.hpp.
>
> 'demangle' does accept a string as the argument - it's just in core::detail.
>
> demangled_name, which is typeinfo-specific, needs to forego demangling when
> RTTI is off, because then core::typeinfo returns an already demangled
> sort-of name using __PRETTY_FUNCTION__.
>
> We can lift demangle() to core:: if you like. I wasn't sure about that so I
> left it in detail.

Yes, please. I would also appreciate if using demangle() would not impose a
dependency on typeinfo.hpp. That would mean one of:

1. Move demangled_name() to typeinfo.hpp. Rename demangled_name.hpp to
demangle.hpp. Include demangle.hpp in typeinfo.hpp and remove #include
<typeinfo.hpp> from demangle.hpp. I.e. reverse the dependency.

2. Move demangle() to a new separate header demangle.hpp and #include it into
demangled_name.hpp.

> > And regarding typeinfo.hpp. Aren't we duplicating Boost.TypeIndex here?
>
> Maybe. I use typeinfo.hpp in lightweight_test_trait.hpp though, and the less
> dependencies a test header has, the better, because a compile error in a
> dependency causes all the tests in the world to fail. Which is undesirable.
> (That's also why I split the _trait part from lightweight_test.)
>
> Plus, typeinfo.hpp was already present, as detail/sp_typeinfo.hpp, I just
> renamed it.

Ok, I see.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk