Skip templated and friended entities in tool
This commit is contained in:
parent
5b9fe7623f
commit
d0451c517b
3 changed files with 9 additions and 7 deletions
|
|
@ -159,6 +159,10 @@ namespace cppast
|
|||
/// \notes Do not use this entity other to read information from the template entity.
|
||||
bool is_templated(const cpp_entity& e) noexcept;
|
||||
|
||||
/// \returns Whether or not the given entity is "friended",
|
||||
/// that is, its declaration exists as part of a [cppast::cpp_friend]() declaration.
|
||||
bool is_friended(const cpp_entity& e) noexcept;
|
||||
|
||||
/// \returns The full name of the [cppast::cpp_entity](), with all scopes.
|
||||
/// \notes Enitites without a name ([cppast::cpp_using_declaration]() etc.) do not have a full name either.
|
||||
/// \notes For (template) parameters the full name is the name itself.
|
||||
|
|
|
|||
|
|
@ -67,10 +67,6 @@ namespace cppast
|
|||
|
||||
friend cpp_entity_container<cpp_friend, cpp_entity>;
|
||||
};
|
||||
|
||||
/// \returns Whether or not the given entity is "friended",
|
||||
/// that is, its declaration exists as part of a [cppast::cpp_friend]() declaration.
|
||||
bool is_friended(const cpp_entity& e) noexcept;
|
||||
} // namespace cppast
|
||||
|
||||
#endif // CPPAST_CPP_FRIEND_HPP_INCLUDED
|
||||
|
|
|
|||
|
|
@ -133,9 +133,11 @@ void print_ast(std::ostream& out, const cppast::cpp_file& file)
|
|||
std::string prefix; // the current prefix string
|
||||
// recursively visit file and all children
|
||||
cppast::visit(file, [&](const cppast::cpp_entity& e, cppast::visitor_info info) {
|
||||
if (e.kind() == cppast::cpp_entity_kind::file_t)
|
||||
// no need to do anything for a file
|
||||
// return value of true continues visit
|
||||
if (e.kind() == cppast::cpp_entity_kind::file_t || cppast::is_templated(e)
|
||||
|| cppast::is_friended(e))
|
||||
// no need to do anything for a file,
|
||||
// templated and friended entities are just proxies, so skip those as well
|
||||
// return true to continue visit for children
|
||||
return true;
|
||||
else if (info.event == cppast::visitor_info::container_entity_exit)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue