Skip to content

Commit da033cd

Browse files
committed
Properly handle anonymous entities in tool
1 parent 455af67 commit da033cd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎tool/main.cpp‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ void print_error(const std::string& msg)
3030
void print_entity(std::ostream& out, const cppast::cpp_entity& e)
3131
{
3232
// print name and the kind of the entity
33-
out << e.name() << " (" << cppast::to_string(e.kind()) << ")";
33+
if (!e.name().empty())
34+
out << e.name();
35+
else
36+
out << "<anonymous>";
37+
out << " (" << cppast::to_string(e.kind()) << ")";
3438

3539
// print whether or not it is a definition
3640
if (cppast::is_definition(e))

0 commit comments

Comments
 (0)