summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2016-05-17 16:02:44 +0200
committerFrancisco Jerez <[email protected]>2016-07-11 20:22:29 -0700
commit423eecb76a24e014198ab2281805e60d76d8f1ae (patch)
treefaecd14f777cf4781d7fb44af5a255956c1d034d /src/gallium/state_trackers
parent5884dfbc2a39adbbcc8ef7e7b53d4299ba2616ff (diff)
clover/llvm: Simplify diagnostic_handler().
Reviewed-by: Serge Martin <[email protected]> Tested-by: Jan Vesely <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/clover/llvm/invocation.cpp14
1 files 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 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<std::string *>(data) };
+ ::llvm::DiagnosticPrinterRawOStream printer { os };
+ di.print(printer);
throw compile_error();
}
}