I recently posted a question to stack overflow regarding this, where a very good answer by unddoch and continued comments by Jim Ingham lead me here. I append the question for reference.
When debugging a c++ program using templates, the output can quickly become unreadable. For this reason it would be convenient, during a debugging session, to rewrite shorten specific type names.
For example
void std::__1::vector<std::__1::tuple<unsigned long, state_change_t, some::namespace::Board<some::namespace::Tile, unsigned long, 42ul>, some::namespace::Path<unsigned int, unsigned int>>, std::__1::allocator<std::__1::tuple<unsigned long, state_change_t, some::namespace::Board<some::namespace::Tile, unsigned long, 42ul>, some::namepsace::Path<unsigned int, unsigned int> > > >::some_interesting_method
Such an entry can appear multiple times in a single line in a backtrace; This quickly becomes unmanageable. It would therefore be convenient to shorten it to something along the lines of
void void std::__1::vector<my_known_type, std::__1::allocator<my_known_type> >::some_interesting_method
How can this be done?
The discussion on Stack Overflow suggested the use of the attribute clang::preferred_name or, ideally, making the c++ demangler aware of shortened names (since clang::preferred_name seems disabled after version 13).
Is there an alternative solution to shorten template names and is it reasonable to submit a feature request for either 1) adding a flag for preferred_name or 2) adding a “display mode” similar for what is implemented for swift? If the latter, where would one submit such a feature request (I’m still new to the specifics of the llvm project)?
Kindly,
ashlaban