diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-09-01 09:35:18 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-01 09:35:18 -0400 |
| commit | cd8715a7760189c54b36c0c250efbe1db5b8635c (patch) | |
| tree | cd1b2e840e64cbdd9e9a383646f0e58a7f14ae97 /source/compiler-core/slang-gcc-compiler-util.cpp | |
| parent | 5c2c2cfc9918bb43225159e67a851e196e17759a (diff) | |
Passing source to Downstream compilation as artifacts (#2382)
* #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++.
* Working with source being passed as artifacts to DownstreamCompiler.
* Use artifacts in SourceManager/SourceFile.
* Support infering extension from the original file extension.
Diffstat (limited to 'source/compiler-core/slang-gcc-compiler-util.cpp')
| -rw-r--r-- | source/compiler-core/slang-gcc-compiler-util.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/compiler-core/slang-gcc-compiler-util.cpp b/source/compiler-core/slang-gcc-compiler-util.cpp index 7bbde64c4..8851477d7 100644 --- a/source/compiler-core/slang-gcc-compiler-util.cpp +++ b/source/compiler-core/slang-gcc-compiler-util.cpp @@ -356,7 +356,7 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS SliceAllocator allocator; diagnostics->reset(); - diagnostics->setRaw(SliceCaster::asCharSlice(exeRes.standardError)); + diagnostics->setRaw(SliceUtil::asCharSlice(exeRes.standardError)); // We hold in workDiagnostics so as it is more convenient to append to the last with a continuation // also means we don't hold the allocations of building up continuations, just the results when finally allocated at the end @@ -456,7 +456,6 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS /* static */SlangResult GCCDownstreamCompilerUtil::calcArgs(const CompileOptions& options, CommandLine& cmdLine) { - SLANG_ASSERT(options.sourceContents.count == 0); SLANG_ASSERT(options.modulePath.count); PlatformKind platformKind = (options.platform == PlatformKind::Unknown) ? PlatformUtil::getPlatformKind() : options.platform; @@ -613,10 +612,15 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS } } - // Files to compile - for (const auto& sourceFile : options.sourceFiles) + // Files to compile, need to be on the file system. + for (IArtifact* sourceArtifact : options.sourceArtifacts) { - cmdLine.addArg(asString(sourceFile)); + ComPtr<IFileArtifactRepresentation> fileRep; + + // TODO(JS): + // Do we want to keep the file on the file system? It's probably reasonable to do so. + SLANG_RETURN_ON_FAIL(sourceArtifact->requireFile(ArtifactKeep::Yes, nullptr, fileRep.writeRef())); + cmdLine.addArg(fileRep->getPath()); } // Add the library paths |
