summaryrefslogtreecommitdiffstats
path: root/source/compiler-core/slang-visual-studio-compiler-util.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-09-01 10:06:19 -0400
committerGitHub <noreply@github.com>2022-09-01 10:06:19 -0400
commit3c0177134d126956336865623ea3d6861be59cfa (patch)
tree920ba158afe75edde6f5254617dfa22ffeb98403 /source/compiler-core/slang-visual-studio-compiler-util.cpp
parentcd8715a7760189c54b36c0c250efbe1db5b8635c (diff)
Make FileSystem files and OS files distinct (#2383)
* #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. * * Infer extension if can't determine from the artifact type * Split IOSFile/IExtFile representations * Move responsibility for creating OS file to the handler. * Disable the check memory path.
Diffstat (limited to 'source/compiler-core/slang-visual-studio-compiler-util.cpp')
-rw-r--r--source/compiler-core/slang-visual-studio-compiler-util.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/source/compiler-core/slang-visual-studio-compiler-util.cpp b/source/compiler-core/slang-visual-studio-compiler-util.cpp
index 17fb96ee8..2d5b37c50 100644
--- a/source/compiler-core/slang-visual-studio-compiler-util.cpp
+++ b/source/compiler-core/slang-visual-studio-compiler-util.cpp
@@ -21,16 +21,16 @@
namespace Slang
{
-static void _addFile(const String& path, const ArtifactDesc& desc, IFileArtifactRepresentation* lockFile, List<ComPtr<IArtifact>>& outArtifacts)
+static void _addFile(const String& path, const ArtifactDesc& desc, IOSFileArtifactRepresentation* lockFile, List<ComPtr<IArtifact>>& outArtifacts)
{
- auto fileRep = FileArtifactRepresentation::create(IFileArtifactRepresentation::Kind::Owned, path.getUnownedSlice(), lockFile, nullptr);
+ auto fileRep = OSFileArtifactRepresentation::create(IOSFileArtifactRepresentation::Kind::Owned, path.getUnownedSlice(), lockFile);
auto artifact = ArtifactUtil::createArtifact(desc);
artifact->addRepresentation(fileRep);
outArtifacts.add(artifact);
}
-/* static */SlangResult VisualStudioCompilerUtil::calcCompileProducts(const CompileOptions& options, ProductFlags flags, IFileArtifactRepresentation* lockFile, List<ComPtr<IArtifact>>& outArtifacts)
+/* static */SlangResult VisualStudioCompilerUtil::calcCompileProducts(const CompileOptions& options, ProductFlags flags, IOSFileArtifactRepresentation* lockFile, List<ComPtr<IArtifact>>& outArtifacts)
{
SLANG_ASSERT(options.modulePath.count);
@@ -238,11 +238,11 @@ static void _addFile(const String& path, const ArtifactDesc& desc, IFileArtifact
// Files to compile, need to be on the file system.
for (IArtifact* sourceArtifact : options.sourceArtifacts)
{
- ComPtr<IFileArtifactRepresentation> fileRep;
+ ComPtr<IOSFileArtifactRepresentation> 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()));
+ SLANG_RETURN_ON_FAIL(sourceArtifact->requireFile(ArtifactKeep::Yes, fileRep.writeRef()));
cmdLine.addArg(fileRep->getPath());
}
@@ -264,12 +264,13 @@ static void _addFile(const String& path, const ArtifactDesc& desc, IFileArtifact
if (ArtifactDescUtil::isCpuBinary(desc) && desc.kind == ArtifactKind::Library)
{
// Get the libray name and path
- ComPtr<IFileArtifactRepresentation> fileRep;
- SLANG_RETURN_ON_FAIL(artifact->requireFile(ArtifactKeep::Yes, nullptr, fileRep.writeRef()));
+ ComPtr<IOSFileArtifactRepresentation> fileRep;
+ SLANG_RETURN_ON_FAIL(artifact->requireFile(ArtifactKeep::Yes, fileRep.writeRef()));
- libPathPool.add(ArtifactUtil::getParentPath(fileRep));
+ const UnownedStringSlice path(fileRep->getPath());
+ libPathPool.add(Path::getParentDirectory(path));
// We need the extension for windows
- cmdLine.addArg(ArtifactDescUtil::getBaseName(artifact->getDesc(), fileRep) + ".lib");
+ cmdLine.addArg(ArtifactDescUtil::getBaseNameFromPath(desc, path) + ".lib");
}
}