parent
6be7e4793e
commit
2d8be149aa
1 changed files with 5 additions and 5 deletions
|
|
@ -414,8 +414,7 @@ namespace
|
||||||
return type_safe::nullopt;
|
return type_safe::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_diagnostics(const diagnostic_logger& logger, const char* path,
|
void print_diagnostics(const diagnostic_logger& logger, const CXTranslationUnit& tu)
|
||||||
const CXTranslationUnit& tu)
|
|
||||||
{
|
{
|
||||||
auto no = clang_getNumDiagnostics(tu);
|
auto no = clang_getNumDiagnostics(tu);
|
||||||
for (auto i = 0u; i != no; ++i)
|
for (auto i = 0u; i != no; ++i)
|
||||||
|
|
@ -425,10 +424,11 @@ namespace
|
||||||
if (sev)
|
if (sev)
|
||||||
{
|
{
|
||||||
auto diag_loc = clang_getDiagnosticLocation(diag);
|
auto diag_loc = clang_getDiagnosticLocation(diag);
|
||||||
|
CXString diag_file;
|
||||||
unsigned line;
|
unsigned line;
|
||||||
clang_getPresumedLocation(diag_loc, nullptr, &line, nullptr);
|
clang_getPresumedLocation(diag_loc, &diag_file, &line, nullptr);
|
||||||
|
|
||||||
auto loc = source_location::make_file(path, line);
|
auto loc = source_location::make_file(detail::cxstring(diag_file).c_str(), 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()});
|
||||||
|
|
@ -476,7 +476,7 @@ namespace
|
||||||
throw libclang_error("clang_parseTranslationUnit: AST deserialization error");
|
throw libclang_error("clang_parseTranslationUnit: AST deserialization error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print_diagnostics(logger, path, tu);
|
print_diagnostics(logger, tu);
|
||||||
|
|
||||||
return detail::cxtranslation_unit(tu);
|
return detail::cxtranslation_unit(tu);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue