diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-09-01 15:38:17 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-01 15:38:17 -0400 |
| commit | be8497804f803c02cfab1aa2c54d921042e90ec9 (patch) | |
| tree | c9451382ba2bf112848441f9d61470a90ed764ee /source/slang/slang-repro.cpp | |
| parent | 174048f26c147e31a6f72907a3af5dfafeedb877 (diff) | |
Remove artifact from SourceFile (#2384)
* #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.
* Remove artifact from SourceFile.
Lazily generate SourceFile from artifacts as needed.
* Fix some small bugs.
* Remove maybeAddArtifact.
* Load artifacts if repro capture is enabled.
* Remove adding by string, because doing so means source will be allocated twice or there is a potential race around ref counting to the contained String.
* Add built in source as a blob.
* Fix warning.
* Make StringBlob own the contents if moved.
Fix some compilation issues.
* Share StringBlob uniqueness code.
* Do move unique on Ctor.
* Change MoveUnique to not have any values.
* MoveUnique can more sensibly be a struct.
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-repro.cpp')
| -rw-r--r-- | source/slang/slang-repro.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/source/slang/slang-repro.cpp b/source/slang/slang-repro.cpp index aa4dc92fc..1597366d6 100644 --- a/source/slang/slang-repro.cpp +++ b/source/slang/slang-repro.cpp @@ -10,6 +10,9 @@ #include "slang-options.h" +#include "../compiler-core/slang-artifact-util.h" +#include "../compiler-core/slang-artifact-desc-util.h" + #include "../compiler-core/slang-source-loc.h" namespace Slang { @@ -996,15 +999,25 @@ struct LoadContext dstTranslationUnit->moduleName = moduleName; const auto& srcSourceFiles = srcTranslationUnit.sourceFiles; - auto& dstSourceFiles = dstTranslationUnit->m_sourceFiles; - dstSourceFiles.clear(); + dstTranslationUnit->clearSource(); + + const auto sourceDesc = ArtifactDescUtil::makeDescForSourceLanguage(asExternal(dstTranslationUnit->sourceLanguage)); for (Index j = 0; j < srcSourceFiles.getCount(); ++j) { + // Create the source file SourceFile* sourceFile = context.getSourceFile(base.asRaw(base.asRaw(srcSourceFiles[i]))); + + // Create the artifact + auto sourceArtifact = ArtifactUtil::createArtifact(sourceDesc, sourceFile->getPathInfo().getName().getBuffer()); + if (sourceFile->getContentBlob()) + { + sourceArtifact->addRepresentationUnknown(sourceFile->getContentBlob()); + } + // Add to translation unit - dstTranslationUnit->addSourceFile(sourceFile); + dstTranslationUnit->addSource(sourceArtifact, sourceFile); } } } |
