Fix error reporting in preprocessor
This commit is contained in:
parent
17477319fb
commit
a8e2676f36
3 changed files with 3 additions and 9 deletions
|
|
@ -8,14 +8,7 @@
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
// treat the tiny-process-library as header only
|
|
||||||
#include <process.hpp>
|
#include <process.hpp>
|
||||||
#include <process.cpp>
|
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32)
|
|
||||||
#include <process_win.cpp>
|
|
||||||
#else
|
|
||||||
#include <process_unix.cpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <type_safe/flag.hpp>
|
#include <type_safe/flag.hpp>
|
||||||
#include <type_safe/optional.hpp>
|
#include <type_safe/optional.hpp>
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ using namespace cppast;
|
||||||
|
|
||||||
bool diagnostic_logger::log(const char* source, const diagnostic& d) const
|
bool diagnostic_logger::log(const char* source, const diagnostic& d) const
|
||||||
{
|
{
|
||||||
if (d.severity == severity::error)
|
if (d.severity == severity::error || d.severity == severity::critical)
|
||||||
error_ = true;
|
error_ = true;
|
||||||
else if (!verbose_ && d.severity == severity::debug)
|
else if (!verbose_ && d.severity == severity::debug)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@ inline std::unique_ptr<cppast::cpp_file> parse(const cppast::cpp_entity_index& i
|
||||||
stderr_diagnostic_logger logger;
|
stderr_diagnostic_logger logger;
|
||||||
libclang_parser p(type_safe::ref(logger));
|
libclang_parser p(type_safe::ref(logger));
|
||||||
|
|
||||||
auto result = p.parse(idx, name, config);
|
std::unique_ptr<cppast::cpp_file> result;
|
||||||
|
REQUIRE_NOTHROW(result = p.parse(idx, name, config));
|
||||||
REQUIRE(!logger.error_logged());
|
REQUIRE(!logger.error_logged());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue