clover/llvm: Simplify diagnostic_handler().
Reviewed-by: Serge Martin <edb+mesa@sigluy.net> Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
This commit is contained in:
@@ -132,15 +132,11 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
diagnostic_handler(const llvm::DiagnosticInfo &di, void *data) {
|
diagnostic_handler(const ::llvm::DiagnosticInfo &di, void *data) {
|
||||||
if (di.getSeverity() == llvm::DS_Error) {
|
if (di.getSeverity() == ::llvm::DS_Error) {
|
||||||
std::string message = *(std::string*)data;
|
raw_string_ostream os { *reinterpret_cast<std::string *>(data) };
|
||||||
llvm::raw_string_ostream stream(message);
|
::llvm::DiagnosticPrinterRawOStream printer { os };
|
||||||
llvm::DiagnosticPrinterRawOStream dp(stream);
|
di.print(printer);
|
||||||
di.print(dp);
|
|
||||||
stream.flush();
|
|
||||||
*(std::string*)data = message;
|
|
||||||
|
|
||||||
throw compile_error();
|
throw compile_error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user