Show line number in error message
This commit is contained in:
parent
be2ea9eb44
commit
08e92c873c
1 changed files with 5 additions and 1 deletions
|
|
@ -371,7 +371,11 @@ namespace
|
||||||
auto sev = get_severity(diag);
|
auto sev = get_severity(diag);
|
||||||
if (sev)
|
if (sev)
|
||||||
{
|
{
|
||||||
auto loc = source_location::make_file(path); // line number won't help
|
auto diag_loc = clang_getDiagnosticLocation(diag);
|
||||||
|
unsigned line;
|
||||||
|
clang_getPresumedLocation(diag_loc, nullptr, &line, nullptr);
|
||||||
|
|
||||||
|
auto loc = source_location::make_file(path, line);
|
||||||
auto text = detail::cxstring(clang_getDiagnosticSpelling(diag));
|
auto text = detail::cxstring(clang_getDiagnosticSpelling(diag));
|
||||||
if (text != "too many errors emitted, stopping now")
|
if (text != "too many errors emitted, stopping now")
|
||||||
logger.log("libclang", diagnostic{text.c_str(), loc, sev.value()});
|
logger.log("libclang", diagnostic{text.c_str(), loc, sev.value()});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue