cppast/src/cpp_friend.cpp
Jonathan Müller c3d1d97892 Add and parse cpp_friend
Only works in clang>=4.
2017-04-06 11:45:17 +02:00

26 lines
681 B
C++

// 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;
}