diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/slang-test/parse-diagnostic-util.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/slang-test/parse-diagnostic-util.cpp b/tools/slang-test/parse-diagnostic-util.cpp index 41dae07f7..db16d0c7e 100644 --- a/tools/slang-test/parse-diagnostic-util.cpp +++ b/tools/slang-test/parse-diagnostic-util.cpp @@ -384,8 +384,27 @@ static SlangResult _findDownstreamCompiler(const UnownedStringSlice& slice, Slan return nullptr; } +static bool _isWhitespace(const UnownedStringSlice& slice) +{ + for (const char c : slice) + { + if (!CharUtil::isWhitespace(c)) + { + return false; + } + } + return true; +} + /* static */SlangResult ParseDiagnosticUtil::parseDiagnostics(const UnownedStringSlice& inText, List<DownstreamDiagnostic>& outDiagnostics) { + if (_isWhitespace(inText)) + { + // If it's empty, then there are no diagnostics to add. + outDiagnostics.clear(); + return SLANG_OK; + } + // TODO(JS): // As it stands output of downstream compilers isn't standardized. This can be improved upon - and if so // we should have a function that will parse the standardized output |
