diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-08-26 20:32:53 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-26 20:32:53 -0400 |
| commit | 5c2c2cfc9918bb43225159e67a851e196e17759a (patch) | |
| tree | 216009d02afe9dc17b074fdd394141ef71472268 /source/compiler-core/slang-gcc-compiler-util.cpp | |
| parent | ef067bef2f2188a4b3c420cbcd8d223874888ed2 (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 'source/compiler-core/slang-gcc-compiler-util.cpp')
| -rw-r--r-- | source/compiler-core/slang-gcc-compiler-util.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/source/compiler-core/slang-gcc-compiler-util.cpp b/source/compiler-core/slang-gcc-compiler-util.cpp index 428da1632..7bbde64c4 100644 --- a/source/compiler-core/slang-gcc-compiler-util.cpp +++ b/source/compiler-core/slang-gcc-compiler-util.cpp @@ -166,7 +166,7 @@ enum class LineParseResult } // anonymous -static SlangResult _parseGCCFamilyLine(CharSliceAllocator& allocator, const UnownedStringSlice& line, LineParseResult& outLineParseResult, ArtifactDiagnostic& outDiagnostic) +static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedStringSlice& line, LineParseResult& outLineParseResult, ArtifactDiagnostic& outDiagnostic) { typedef ArtifactDiagnostic Diagnostic; typedef Diagnostic::Severity Severity; @@ -353,10 +353,10 @@ static SlangResult _parseGCCFamilyLine(CharSliceAllocator& allocator, const Unow { LineParseResult prevLineResult = LineParseResult::Ignore; - CharSliceAllocator allocator; + SliceAllocator allocator; diagnostics->reset(); - diagnostics->setRaw(CharSliceCaster::asCharSlice(exeRes.standardError)); + diagnostics->setRaw(SliceCaster::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 @@ -434,7 +434,7 @@ static SlangResult _parseGCCFamilyLine(CharSliceAllocator& allocator, const Unow /* static */SlangResult GCCDownstreamCompilerUtil::calcCompileProducts(const CompileOptions& options, ProductFlags flags, IFileArtifactRepresentation* lockFile, List<ComPtr<IArtifact>>& outArtifacts) { - SLANG_ASSERT(options.modulePath.getLength()); + SLANG_ASSERT(options.modulePath.count); outArtifacts.clear(); @@ -442,7 +442,7 @@ static SlangResult _parseGCCFamilyLine(CharSliceAllocator& allocator, const Unow { StringBuilder builder; const auto desc = ArtifactDescUtil::makeDescForCompileTarget(options.targetType); - SLANG_RETURN_ON_FAIL(ArtifactDescUtil::calcPathForDesc(desc, options.modulePath.getUnownedSlice(), builder)); + SLANG_RETURN_ON_FAIL(ArtifactDescUtil::calcPathForDesc(desc, asStringSlice(options.modulePath), builder)); auto fileRep = FileArtifactRepresentation::create(IFileArtifactRepresentation::Kind::Owned, builder.getUnownedSlice(), lockFile, nullptr); auto artifact = ArtifactUtil::createArtifact(desc); @@ -456,8 +456,8 @@ static SlangResult _parseGCCFamilyLine(CharSliceAllocator& allocator, const Unow /* static */SlangResult GCCDownstreamCompilerUtil::calcArgs(const CompileOptions& options, CommandLine& cmdLine) { - SLANG_ASSERT(options.sourceContents.getLength() == 0); - SLANG_ASSERT(options.modulePath.getLength()); + SLANG_ASSERT(options.sourceContents.count == 0); + SLANG_ASSERT(options.modulePath.count); PlatformKind platformKind = (options.platform == PlatformKind::Unknown) ? PlatformUtil::getPlatformKind() : options.platform; @@ -539,7 +539,7 @@ static SlangResult _parseGCCFamilyLine(CharSliceAllocator& allocator, const Unow } StringBuilder moduleFilePath; - SLANG_RETURN_ON_FAIL(ArtifactDescUtil::calcPathForDesc(targetDesc, options.modulePath.getUnownedSlice(), moduleFilePath)); + SLANG_RETURN_ON_FAIL(ArtifactDescUtil::calcPathForDesc(targetDesc, asStringSlice(options.modulePath), moduleFilePath)); cmdLine.addArg("-o"); cmdLine.addArg(moduleFilePath); @@ -579,9 +579,9 @@ static SlangResult _parseGCCFamilyLine(CharSliceAllocator& allocator, const Unow builder << "-D"; builder << define.nameWithSig; - if (define.value.getLength()) + if (define.value.count) { - builder << "=" << define.value; + builder << "=" << asStringSlice(define.value); } cmdLine.addArg(builder); @@ -591,7 +591,7 @@ static SlangResult _parseGCCFamilyLine(CharSliceAllocator& allocator, const Unow for (const auto& include : options.includePaths) { cmdLine.addArg("-I"); - cmdLine.addArg(include); + cmdLine.addArg(asString(include)); } // Link options @@ -616,12 +616,12 @@ static SlangResult _parseGCCFamilyLine(CharSliceAllocator& allocator, const Unow // Files to compile for (const auto& sourceFile : options.sourceFiles) { - cmdLine.addArg(sourceFile); + cmdLine.addArg(asString(sourceFile)); } // Add the library paths - if (options.libraryPaths.getCount() && options.targetType == SLANG_HOST_EXECUTABLE) + if (options.libraryPaths.count && options.targetType == SLANG_HOST_EXECUTABLE) { cmdLine.addArg("-Wl,-rpath,$ORIGIN"); } |
