diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-01-10 16:42:24 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-10 16:42:24 -0500 |
| commit | 7ba0a80cd56d7ec7f2a4bf8061134bf0d89f7673 (patch) | |
| tree | ba82f2d13abe639548d5e26cdcf93cbe34d6ea93 | |
| parent | dbf5f413cd7a7b0448312a6f198b2a544087ac58 (diff) | |
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)
| -rw-r--r-- | source/slang/slang.cpp | 7 |
1 files 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; } } |
