Properly handle anonymous entities in tool

This commit is contained in:
Jonathan Müller 2017-04-19 17:17:30 +02:00
commit da033cdebe

View file

@ -30,7 +30,11 @@ void print_error(const std::string& msg)
void print_entity(std::ostream& out, const cppast::cpp_entity& e)
{
// print name and the kind of the entity
out << e.name() << " (" << cppast::to_string(e.kind()) << ")";
if (!e.name().empty())
out << e.name();
else
out << "<anonymous>";
out << " (" << cppast::to_string(e.kind()) << ")";
// print whether or not it is a definition
if (cppast::is_definition(e))