From 7f266f1ea7a51213069282296a905650fd405c3f Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 4 Feb 2021 14:23:32 -0500 Subject: DownstreamDiagnostic::Type -> Severity (#1687) * #include an absolute path didn't work - because paths were taken to always be relative. * WIP diagnostics for line number output. * Small param naming change * Use x macro for pass through compile human name lookup/getting. * WIP on parsing downstream compiler output. * Split out parsing into ParseDiagnosticUtil. Added test result of single line. * Dump out the std output on fail to parse diagnostics. * Change test type for syntax-error-intrinsic.slang be TEST not TEST_DIAGNOSTIC * Use Index for StringUtil. * WIP: First pass support for parsing Slang diagnostics. * WIP Testing comparing with ParseDiagnosticUtil with previous ad-hoc mechanism. * Use the new parsing mechanism for diagnostic comparisons. * Improvements to diagnostics parsing. Better error handling, and fallback handling. Added ability to parse downstream compilers without a prefix. Added ability to parse Slang with a prefix. * DownstreamDiagnostic::Type -> Severity and related fixes. * Small fixes around moving from DownstreamDiagnostic::Type -> Severity * Small comment fixes. Co-authored-by: Tim Foley --- source/core/slang-visual-studio-compiler-util.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source/core/slang-visual-studio-compiler-util.cpp') diff --git a/source/core/slang-visual-studio-compiler-util.cpp b/source/core/slang-visual-studio-compiler-util.cpp index af05c9c95..a3578483f 100644 --- a/source/core/slang-visual-studio-compiler-util.cpp +++ b/source/core/slang-visual-studio-compiler-util.cpp @@ -258,21 +258,21 @@ namespace Slang return SLANG_OK; } -static SlangResult _parseErrorType(const UnownedStringSlice& in, DownstreamDiagnostics::Diagnostic::Type& outType) +static SlangResult _parseSeverity(const UnownedStringSlice& in, DownstreamDiagnostics::Diagnostic::Severity& outSeverity) { - typedef DownstreamDiagnostics::Diagnostic::Type Type; + typedef DownstreamDiagnostics::Diagnostic::Severity Type; if (in == "error" || in == "fatal error") { - outType = Type::Error; + outSeverity = Type::Error; } else if (in == "warning") { - outType = Type::Warning; + outSeverity = Type::Warning; } else if (in == "info") { - outType = Type::Info; + outSeverity = Type::Info; } else { @@ -289,7 +289,7 @@ static SlangResult _parseVisualStudioLine(const UnownedStringSlice& line, Downst if (line.startsWith(linkPrefix)) { outDiagnostic.stage = Diagnostic::Stage::Link; - outDiagnostic.type = Diagnostic::Type::Info; + outDiagnostic.severity = Diagnostic::Severity::Info; outDiagnostic.text = UnownedStringSlice(line.begin() + linkPrefix.getLength(), line.end()); @@ -394,7 +394,7 @@ static SlangResult _parseVisualStudioLine(const UnownedStringSlice& line, Downst } // Extract the bit before the code - SLANG_RETURN_ON_FAIL(_parseErrorType(UnownedStringSlice(errorSection.begin(), errorSection.begin() + errorCodeIndex).trim(), outDiagnostic.type)); + SLANG_RETURN_ON_FAIL(_parseSeverity(UnownedStringSlice(errorSection.begin(), errorSection.begin() + errorCodeIndex).trim(), outDiagnostic.severity)); // Link codes start with LNK prefix postError = UnownedStringSlice(postPath.begin() + errorColonIndex + 1, end); @@ -426,7 +426,7 @@ static SlangResult _parseVisualStudioLine(const UnownedStringSlice& line, Downst } // if it has a compilation error.. set on output - if (outDiagnostics.has(Diagnostic::Type::Error)) + if (outDiagnostics.has(Diagnostic::Severity::Error)) { outDiagnostics.result = SLANG_FAIL; } -- cgit v1.2.3