Add and parse cpp_friend

Only works in clang>=4.
This commit is contained in:
Jonathan Müller 2017-04-06 11:45:17 +02:00
commit c3d1d97892
18 changed files with 629 additions and 92 deletions

26
src/cpp_friend.cpp Normal file
View file

@ -0,0 +1,26 @@
// Copyright (C) 2017 Jonathan Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
#include <cppast/cpp_friend.hpp>
#include <cppast/cpp_entity_kind.hpp>
using namespace cppast;
cpp_entity_kind cpp_friend::kind() noexcept
{
return cpp_entity_kind::friend_t;
}
cpp_entity_kind cpp_friend::do_get_entity_kind() const noexcept
{
return kind();
}
bool cppast::is_friended(const cpp_entity& e) noexcept
{
if (is_templated(e))
return is_friended(e.parent().value());
return e.parent() && e.parent().value().kind() == cpp_entity_kind::friend_t;
}