Format preprocessor diagnostics
This commit is contained in:
parent
108fd1b2ee
commit
f66fa70b1f
3 changed files with 106 additions and 12 deletions
|
|
@ -46,7 +46,7 @@ namespace cppast
|
|||
{
|
||||
result += file.value() + ":";
|
||||
if (line)
|
||||
result += line.value() + ":";
|
||||
result += std::to_string(line.value()) + ":";
|
||||
if (entity)
|
||||
result += " (" + entity.value() + "):";
|
||||
}
|
||||
|
|
@ -66,6 +66,22 @@ namespace cppast
|
|||
/// \notes This will usually result in an exception being thrown after the diagnostic has been displayed.
|
||||
};
|
||||
|
||||
/// \returns A human-readable string describing the severity.
|
||||
inline const char* to_string(severity s) noexcept
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case severity::warning:
|
||||
return "warning";
|
||||
case severity::error:
|
||||
return "error";
|
||||
case severity::critical:
|
||||
return "critical";
|
||||
}
|
||||
|
||||
return "programmer error";
|
||||
}
|
||||
|
||||
/// A diagnostic.
|
||||
///
|
||||
/// It represents an error message from a [cppast::parser]().
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue