From cd8715a7760189c54b36c0c250efbe1db5b8635c Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 1 Sep 2022 09:35:18 -0400 Subject: 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. --- source/compiler-core/slang-include-system.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source/compiler-core/slang-include-system.cpp') diff --git a/source/compiler-core/slang-include-system.cpp b/source/compiler-core/slang-include-system.cpp index 891d376f6..455ecde2b 100644 --- a/source/compiler-core/slang-include-system.cpp +++ b/source/compiler-core/slang-include-system.cpp @@ -4,9 +4,22 @@ #include "../core/slang-io.h" #include "../core/slang-string-util.h" +#include "../core/slang-file-system.h" + +#include "slang-slice-allocator.h" +#include "slang-artifact-impl.h" +#include "slang-artifact-representation-impl.h" + namespace Slang { +IncludeSystem::IncludeSystem(SearchDirectoryList* searchDirectories, ISlangFileSystemExt* fileSystemExt, SourceManager* sourceManager) : + m_searchDirectories(searchDirectories), + m_fileSystemExt(fileSystemExt), + m_sourceManager(sourceManager) +{ +} + SlangResult IncludeSystem::findFile(SlangPathType fromPathType, const String& fromPath, const String& path, PathInfo& outPathInfo) { String combinedPath; @@ -119,6 +132,8 @@ SlangResult IncludeSystem::loadFile(const PathInfo& pathInfo, ComPtr sourceFile = m_sourceManager->createSourceFileWithBlob(pathInfo, foundSourceBlob); m_sourceManager->addSourceFile(pathInfo.uniqueIdentity, sourceFile); + sourceFile->maybeAddArtifact(m_fileSystemExt); + outBlob = foundSourceBlob; return SLANG_OK; } @@ -137,6 +152,8 @@ SlangResult IncludeSystem::loadFile(const PathInfo& pathInfo, ComPtr } sourceFile->setContents(foundSourceBlob); + sourceFile->maybeAddArtifact(m_fileSystemExt); + outBlob = foundSourceBlob; return SLANG_OK; } -- cgit v1.2.3