Fix include handling support

Can't be tested until clang 4.0.
This commit is contained in:
Jonathan Müller 2017-02-16 20:33:48 +01:00
commit 2e1dce2ffd
5 changed files with 98 additions and 17 deletions

View file

@ -32,13 +32,10 @@ namespace cppast
return target_;
}
/// \returns The [cppast::cpp_entity]() it refers to.
/// \requires An entity of matching kind must be registered in the [cppast::cpp_entity_index]() using the given id.
const T& get(const cpp_entity_index& idx) const noexcept
/// \returns An optional reference to the [cppast::cpp_entity]() it refers to.
type_safe::optional_ref<const T> get(const cpp_entity_index& idx) const noexcept
{
auto entity = idx.lookup(target_);
DEBUG_ASSERT(Predicate{}(entity.value()), detail::precondition_error_handler{},
"invalid entity");
return static_cast<const T&>(entity.value());
}

View file

@ -74,6 +74,8 @@ namespace cppast
class cpp_include_directive final : public cpp_entity
{
public:
static cpp_entity_kind kind() noexcept;
/// \returns A newly built include directive.
/// \notes It is not meant to be registered in the [cppast::cpp_entity_index](),
/// as no other [cppast::cpp_entity]() can refer to it.