summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/slang-test/parse-diagnostic-util.cpp94
-rw-r--r--tools/slang-test/parse-diagnostic-util.h6
-rw-r--r--tools/slang-test/slang-test-main.cpp2
3 files changed, 5 insertions, 97 deletions
diff --git a/tools/slang-test/parse-diagnostic-util.cpp b/tools/slang-test/parse-diagnostic-util.cpp
index 6e4eefab8..39d7274a7 100644
--- a/tools/slang-test/parse-diagnostic-util.cpp
+++ b/tools/slang-test/parse-diagnostic-util.cpp
@@ -15,68 +15,6 @@
using namespace Slang;
-/* static */SlangResult ParseDiagnosticUtil::splitPathLocation(const UnownedStringSlice& pathLocation, DownstreamDiagnostic& outDiagnostic)
-{
- const Index lineStartIndex = pathLocation.lastIndexOf('(');
- if (lineStartIndex >= 0)
- {
- outDiagnostic.filePath = UnownedStringSlice(pathLocation.head(lineStartIndex).trim());
-
- const UnownedStringSlice tail = pathLocation.tail(lineStartIndex + 1);
- const Index lineEndIndex = tail.indexOf(')');
-
- if (lineEndIndex >= 0)
- {
- // Extract the location info
- UnownedStringSlice locationSlice(tail.begin(), tail.begin() + lineEndIndex);
-
- UnownedStringSlice slices[2];
- const Index numSlices = StringUtil::split(locationSlice, ',', 2, slices);
- Int locationIndex[2] = { 0, 0 };
-
- for (Index i = 0; i < numSlices; ++i)
- {
- SLANG_RETURN_ON_FAIL(StringUtil::parseInt(slices[i], locationIndex[i]));
- }
-
- // Store the line
- outDiagnostic.fileLine = locationIndex[0];
- }
- }
- else
- {
- outDiagnostic.filePath = pathLocation;
- }
- return SLANG_OK;
-}
-
-/* static */SlangResult ParseDiagnosticUtil::parseFXCLine(const UnownedStringSlice& line, List<UnownedStringSlice>& lineSlices, DownstreamDiagnostic& outDiagnostic)
-{
- /* tests/diagnostics/syntax-error-intrinsic.slang(14,2): error X3000: syntax error: unexpected token '@' */
- if (lineSlices.getCount() < 3)
- {
- return SLANG_FAIL;
- }
-
- SLANG_RETURN_ON_FAIL(splitPathLocation(lineSlices[0], outDiagnostic));
-
- {
- const UnownedStringSlice severityAndCodeSlice = lineSlices[1].trim();
- const UnownedStringSlice severitySlice = StringUtil::getAtInSplit(severityAndCodeSlice, ' ', 0);
-
- outDiagnostic.code = StringUtil::getAtInSplit(severityAndCodeSlice, ' ', 1);
-
- outDiagnostic.severity = DownstreamDiagnostic::Severity::Error;
- if (severitySlice == "warning")
- {
- outDiagnostic.severity = DownstreamDiagnostic::Severity::Warning;
- }
- }
-
- outDiagnostic.text = UnownedStringSlice(lineSlices[2].begin(), line.end());
- return SLANG_OK;
-}
-
/* static */SlangResult ParseDiagnosticUtil::parseDXCLine(const UnownedStringSlice& line, List<UnownedStringSlice>& lineSlices, DownstreamDiagnostic& outDiagnostic)
{
/* tests/diagnostics/syntax-error-intrinsic.slang:14:2: error: expected expression */
@@ -157,7 +95,7 @@ using namespace Slang;
}
// Get the location info
- SLANG_RETURN_ON_FAIL(splitPathLocation(lineSlices[0], outDiagnostic));
+ SLANG_RETURN_ON_FAIL(DownstreamDiagnostic::splitPathLocation(lineSlices[0], outDiagnostic));
outDiagnostic.text = UnownedStringSlice(lineSlices[2].begin(), line.end());
return SLANG_OK;
@@ -238,7 +176,7 @@ static bool _isSlangDiagnostic(const UnownedStringSlice& line)
return SLANG_FAIL;
}
- SLANG_RETURN_ON_FAIL(splitPathLocation(lineSlices[0], outDiagnostic));
+ SLANG_RETURN_ON_FAIL(DownstreamDiagnostic::splitPathLocation(lineSlices[0], outDiagnostic));
Int code;
SLANG_RETURN_ON_FAIL(_getSlangDiagnosticSeverity(lineSlices[1], outDiagnostic.severity, code));
@@ -292,29 +230,6 @@ static bool _isSlangDiagnostic(const UnownedStringSlice& line)
return SLANG_OK;
}
-static void _addDiagnosticNote(const UnownedStringSlice& in, List<DownstreamDiagnostic>& outDiagnostics)
-{
- // Don't bother adding an empty line
- if (in.trim().getLength() == 0)
- {
- return;
- }
-
- // If there's nothing previous, we'll ignore too, as note should be in addition to
- // a pre-existing error/warning
- if (outDiagnostics.getCount() == 0)
- {
- return;
- }
-
- // Make it a note on the output
- DownstreamDiagnostic diagnostic;
- diagnostic.reset();
- diagnostic.severity = DownstreamDiagnostic::Severity::Info;
- diagnostic.text = in;
- outDiagnostics.add(diagnostic);
-}
-
static SlangResult _findDownstreamCompiler(const UnownedStringSlice& slice, SlangPassThrough& outDownstreamCompiler)
{
for (Index i = SLANG_PASS_THROUGH_NONE + 1; i < SLANG_PASS_THROUGH_COUNT_OF; ++i)
@@ -375,7 +290,6 @@ static SlangResult _findDownstreamCompiler(const UnownedStringSlice& slice, Slan
{
switch (compilerIdentity.m_downstreamCompiler)
{
- case SLANG_PASS_THROUGH_FXC: return &parseFXCLine;
case SLANG_PASS_THROUGH_DXC: return &parseDXCLine;
case SLANG_PASS_THROUGH_GLSLANG: return &parseGlslangLine;
default: return &parseGenericLine;
@@ -458,7 +372,7 @@ static bool _isWhitespace(const UnownedStringSlice& slice)
// If we don't have a valid split then just assume it's a note
if (!isValidSplit)
{
- _addDiagnosticNote(line, outDiagnostics);
+ DownstreamDiagnostics::addNote(line, outDiagnostics);
continue;
}
@@ -474,7 +388,7 @@ static bool _isWhitespace(const UnownedStringSlice& slice)
else
{
// If couldn't parse, just add as a note
- _addDiagnosticNote(line, outDiagnostics);
+ DownstreamDiagnostics::addNote(line, outDiagnostics);
}
}
diff --git a/tools/slang-test/parse-diagnostic-util.h b/tools/slang-test/parse-diagnostic-util.h
index 07df7a14d..4c4aaa75c 100644
--- a/tools/slang-test/parse-diagnostic-util.h
+++ b/tools/slang-test/parse-diagnostic-util.h
@@ -60,12 +60,6 @@ struct ParseDiagnosticUtil
/// Given a compiler identity returns a line parsing function.
static LineParser getLineParser(const CompilerIdentity& compilerIdentity);
- /// Given a path, that holds line number and potentially column number in () after path, writes result into outDiagnostic
- static SlangResult splitPathLocation(const Slang::UnownedStringSlice& pathLocation, Slang::DownstreamDiagnostic& outDiagnostic);
-
- /// For FXC lines
- static SlangResult parseFXCLine(const Slang::UnownedStringSlice& line, Slang::List<Slang::UnownedStringSlice>& lineSlices, Slang::DownstreamDiagnostic& outDiagnostic);
-
/// For DXC lines
static SlangResult parseDXCLine(const Slang::UnownedStringSlice& line, Slang::List<Slang::UnownedStringSlice>& lineSlices, Slang::DownstreamDiagnostic& outDiagnostic);
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index 530d9a115..ded4c777c 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -1687,7 +1687,7 @@ static TestResult runCPPCompilerSharedLibrary(TestContext* context, TestInput& i
options.sourceLanguage = (ext == "c") ? SLANG_SOURCE_LANGUAGE_C : SLANG_SOURCE_LANGUAGE_CPP;
// Build a shared library
- options.targetType = DownstreamCompiler::TargetType::SharedLibrary;
+ options.targetType = SLANG_SHARED_LIBRARY;
// Compile this source
options.sourceFiles.add(filePath);