Parse cpp_type_alias and simple cpp_type's
This commit is contained in:
parent
a38641ecb1
commit
b183513166
13 changed files with 533 additions and 13 deletions
|
|
@ -22,6 +22,11 @@ namespace cppast
|
|||
return source_location::make(get_display_name(cur).c_str());
|
||||
}
|
||||
|
||||
inline source_location make_location(const CXType& type)
|
||||
{
|
||||
return source_location::make(cxstring(clang_getTypeSpelling(type)).c_str());
|
||||
}
|
||||
|
||||
// thrown on a parsing error
|
||||
// not meant to escape to the user
|
||||
class parse_error : public std::logic_error
|
||||
|
|
@ -37,6 +42,11 @@ namespace cppast
|
|||
{
|
||||
}
|
||||
|
||||
parse_error(const CXType& type, std::string message)
|
||||
: parse_error(make_location(type), std::move(message))
|
||||
{
|
||||
}
|
||||
|
||||
diagnostic get_diagnostic() const
|
||||
{
|
||||
return diagnostic{what(), location_, severity::error};
|
||||
|
|
@ -55,6 +65,12 @@ namespace cppast
|
|||
{
|
||||
throw parse_error(cur, std::move(message));
|
||||
}
|
||||
|
||||
static void handle(const debug_assert::source_location&, const char*,
|
||||
const CXType& type, std::string message)
|
||||
{
|
||||
throw parse_error(type, std::move(message));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename... Args>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue