summaryrefslogtreecommitdiff
path: root/tools/slang-test/slang-test-main.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-08-26 20:32:53 -0400
committerGitHub <noreply@github.com>2022-08-26 20:32:53 -0400
commit5c2c2cfc9918bb43225159e67a851e196e17759a (patch)
tree216009d02afe9dc17b074fdd394141ef71472268 /tools/slang-test/slang-test-main.cpp
parentef067bef2f2188a4b3c420cbcd8d223874888ed2 (diff)
DownstreamCompileOptions using POD types (#2381)
* #include an absolute path didn't work - because paths were taken to always be relative. * Make DownstreamCompileOptions use POD types. * CharSliceAllocator -> SliceAllocator Added SliceConverter CharSliceCaster -> SliceCaster * First attempt at zero terminating around blobs. * Fix clang warning. * Add SlangTerminatedChars Make Blob implementations support it. Make most blobs 'terminated'. * Fix bug setting up sourceFiles for CommandLineDownstreamCompiler. * Traffic in TerminatedCharSlice for sourceFiles. Use ArtifactDesc to generate temporary file names for source. * Fix typo in testing for shared library/C++.
Diffstat (limited to 'tools/slang-test/slang-test-main.cpp')
-rw-r--r--tools/slang-test/slang-test-main.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index af7ca1f83..cd783bb05 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -2233,10 +2233,12 @@ static TestResult runCPPCompilerSharedLibrary(TestContext* context, TestInput& i
options.targetType = SLANG_SHADER_SHARED_LIBRARY;
// Compile this source
- options.sourceFiles.add(filePath);
- options.modulePath = modulePath;
+ TerminatedCharSlice sourceFiles[] = { SliceCaster::asTerminatedCharSlice(filePath) };
+ TerminatedCharSlice includePaths[] = { TerminatedCharSlice(".") };
- options.includePaths.add(".");
+ options.sourceFiles = makeSlice(sourceFiles, 1);
+ options.includePaths = makeSlice(includePaths, 1);
+ options.modulePath = SliceCaster::asTerminatedCharSlice(modulePath);
ComPtr<IArtifact> artifact;
if (SLANG_FAILED(compiler->compile(options, artifact.writeRef())))
@@ -2351,9 +2353,11 @@ static TestResult runCPPCompilerExecute(TestContext* context, TestInput& input)
options.sourceLanguage = (ext == "c") ? SLANG_SOURCE_LANGUAGE_C : SLANG_SOURCE_LANGUAGE_CPP;
+ TerminatedCharSlice filePaths[] = { SliceCaster::asTerminatedCharSlice(filePath) };
+
// Compile this source
- options.sourceFiles.add(filePath);
- options.modulePath = modulePath;
+ options.sourceFiles = makeSlice(filePaths, 1);
+ options.modulePath = SliceCaster::asTerminatedCharSlice(modulePath);
ComPtr<IArtifact> artifact;
if (SLANG_FAILED(compiler->compile(options, artifact.writeRef())))