From 7ba0a80cd56d7ec7f2a4bf8061134bf0d89f7673 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 10 Jan 2019 16:42:24 -0500 Subject: Fixes problem when passing in nullptr for the channel - we need the DiagnosticSink.writer to be nullptr so that we get the buffered result. Unfortunately here, it was set to the default for the channel, which in diagnostics case meant throwing away the diagnostic. (#770) --- source/slang/slang.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index be6edc381..22f6feac3 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -400,12 +400,13 @@ static ISlangWriter* _getDefaultWriter(WriterChannel chan) void CompileRequest::setWriter(WriterChannel chan, ISlangWriter* writer) { - writer = writer ? writer : _getDefaultWriter(chan); - m_writers[int(chan)] = writer; + // If the user passed in null, we will use the default writer on that channel + m_writers[int(chan)] = writer ? writer : _getDefaultWriter(chan); + // For diagnostic output, if the user passes in nullptr, we set on mSink.writer as that enables buffering on DiagnosticSink if (chan == WriterChannel::Diagnostic) { - mSink.writer = writer; + mSink.writer = writer; } } -- cgit v1.2.3