summaryrefslogtreecommitdiffstats
path: root/source/compiler-core/slang-include-system.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2022-09-01 09:35:18 -0400
committerGitHub <noreply@github.com>2022-09-01 09:35:18 -0400
commitcd8715a7760189c54b36c0c250efbe1db5b8635c (patch)
treecd1b2e840e64cbdd9e9a383646f0e58a7f14ae97 /source/compiler-core/slang-include-system.cpp
parent5c2c2cfc9918bb43225159e67a851e196e17759a (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-include-system.cpp')
-rw-r--r--source/compiler-core/slang-include-system.cpp17
1 files changed, 17 insertions, 0 deletions
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<ISlangBlob>
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<ISlangBlob>
}
sourceFile->setContents(foundSourceBlob);
+ sourceFile->maybeAddArtifact(m_fileSystemExt);
+
outBlob = foundSourceBlob;
return SLANG_OK;
}