From: Francisco Jerez Date: Tue, 17 May 2016 14:02:44 +0000 (+0200) Subject: clover/llvm: Simplify diagnostic_handler(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=423eecb76a24e014198ab2281805e60d76d8f1ae;p=mesa.git clover/llvm: Simplify diagnostic_handler(). Reviewed-by: Serge Martin Tested-by: Jan Vesely --- diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp index 2ca57d04300..962f1bf142e 100644 --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp @@ -132,15 +132,11 @@ namespace { } void - diagnostic_handler(const llvm::DiagnosticInfo &di, void *data) { - if (di.getSeverity() == llvm::DS_Error) { - std::string message = *(std::string*)data; - llvm::raw_string_ostream stream(message); - llvm::DiagnosticPrinterRawOStream dp(stream); - di.print(dp); - stream.flush(); - *(std::string*)data = message; - + diagnostic_handler(const ::llvm::DiagnosticInfo &di, void *data) { + if (di.getSeverity() == ::llvm::DS_Error) { + raw_string_ostream os { *reinterpret_cast(data) }; + ::llvm::DiagnosticPrinterRawOStream printer { os }; + di.print(printer); throw compile_error(); } }