Parse cpp_namespace

This commit is contained in:
Jonathan Müller 2017-02-21 22:36:38 +01:00
commit ce69b0157f
11 changed files with 160 additions and 16 deletions

View file

@ -4,13 +4,28 @@
#include "parse_functions.hpp"
#include "parse_error.hpp"
using namespace cppast;
cpp_entity_id detail::get_entity_id(const CXCursor& cur)
{
cxstring usr(clang_getCursorUSR(cur));
DEBUG_ASSERT(!usr.empty(), detail::parse_error_handler{}, cur, "cannot create id for entity");
return cpp_entity_id(usr.c_str());
}
std::unique_ptr<cpp_entity> detail::parse_entity(const detail::parse_context& context,
const CXCursor& cur) try
{
auto kind = clang_getCursorKind(cur);
switch (kind)
{
case CXCursor_Namespace:
return parse_cpp_namespace(context, cur);
default:
break;
}
return nullptr;
}
catch (parse_error& ex)