Fix and test include directive parsing

This commit is contained in:
Jonathan Müller 2017-04-03 09:49:29 +02:00
commit 9c46c96820
7 changed files with 90 additions and 21 deletions

View file

@ -20,7 +20,11 @@ bool diagnostic_logger::log(const char* source, const diagnostic& d) const
bool stderr_diagnostic_logger::do_log(const char* source, const diagnostic& d) const
{
std::fprintf(stderr, "[%s] [%s] %s %s\n", source, to_string(d.severity),
d.location.to_string().c_str(), d.message.c_str());
auto loc = d.location.to_string();
if (loc.empty())
std::fprintf(stderr, "[%s] [%s] %s\n", source, to_string(d.severity), d.message.c_str());
else
std::fprintf(stderr, "[%s] [%s] %s %s\n", source, to_string(d.severity),
d.location.to_string().c_str(), d.message.c_str());
return true;
}