Add and use libclang_error exception class

This commit is contained in:
Jonathan Müller 2017-02-16 21:33:41 +01:00
commit a0c2eece5b
3 changed files with 32 additions and 2 deletions

View file

@ -5,6 +5,8 @@
#ifndef CPPAST_LIBCLANG_PARSER_HPP_INCLUDED
#define CPPAST_LIBCLANG_PARSER_HPP_INCLUDED
#include <stdexcept>
#include <cppast/parser.hpp>
namespace cppast
@ -53,6 +55,16 @@ namespace cppast
friend detail::libclang_compile_config_access;
};
/// The exception thrown when a fatal parse error occurs.
class libclang_error final : public std::runtime_error
{
public:
/// \effects Creates it with a message.
libclang_error(std::string msg) : std::runtime_error(std::move(msg))
{
}
};
/// A parser that uses libclang.
class libclang_parser final : public parser
{