[Mesa-dev] [PATCH 12/47] clover/llvm: Simplify diagnostic_handler().

Francisco Jerez currojerez at riseup.net
Mon Jul 4 00:51:21 UTC 2016


Reviewed-by: Serge Martin <edb+mesa at sigluy.net>
---
 src/gallium/state_trackers/clover/llvm/invocation.cpp | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index 2ca57d0..962f1bf 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<std::string *>(data) };
+         ::llvm::DiagnosticPrinterRawOStream printer { os };
+         di.print(printer);
          throw compile_error();
       }
    }
-- 
2.9.0



More information about the mesa-dev mailing list