Skip to content

Commit

Permalink
fix: parent name duplicate (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe authored Dec 13, 2023
1 parent 1767ab7 commit f04b258
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cxx-parser/cxx/terra/include/terra.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,15 @@ namespace terra
cpp_entity.parent().value().kind() != cppast::cpp_entity_kind::namespace_t)
{
parent_name = cpp_entity.parent().value().name();
// some cppast::cpp_entity_kind has no parent, but parent_name is not empty
// such as agora::util::CopyableAutoPtr
// we need to set parent_name to empty
if (base_node.name.compare(parent_name) == 0)
{
parent_name = "";
}
}

base_node.parent_name = parent_name;
base_node.attributes = std::vector<std::string>(parse_attributes(cpp_entity));
adjust_comment_and_directives(base_node, cpp_entity);
Expand Down

0 comments on commit f04b258

Please sign in to comment.