Reinstantiate better diagnostic, this time with a fatal error so we don't add a dependency onto gtest from the header.

llvm-svn: 244722
This commit is contained in:
Manuel Klimek 2015-08-12 07:57:16 +00:00
parent a77cea49d1
commit 9b2c45398f
1 changed files with 7 additions and 2 deletions

View File

@ -76,8 +76,13 @@ runCheckOnCode(StringRef Code, std::vector<ClangTidyError> *Errors = nullptr,
FileContent.second);
}
Invocation.setDiagnosticConsumer(&DiagConsumer);
if (!Invocation.run())
return "";
if (!Invocation.run()) {
std::string ErrorText;
for (const auto &Error:Context.getErrors()) {
ErrorText += Error.Message.Message + "\n";
}
llvm::report_fatal_error(ErrorText);
}
DiagConsumer.finish();
tooling::Replacements Fixes;