diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-10-08 09:37:46 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-08 09:37:46 -0400 |
| commit | cae56127251b4766f686c2ec6d4672da3ded160f (patch) | |
| tree | be12c15ce45d340991c0b7ed6af864d3f6906dfc /source | |
| parent | 73a8cb5c22be2077358fe17085398af956b62595 (diff) | |
Make CPU/C++ generate a single temporary file name basis that used for both source (if source isn't available as a file) and binaries. (#1070)
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-compiler.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp index a24289d22..c8cc947f4 100644 --- a/source/slang/slang-compiler.cpp +++ b/source/slang/slang-compiler.cpp @@ -1336,14 +1336,20 @@ SlangResult dissassembleDXILUsingDXC( rawSourceLanguage = SourceLanguage::CPP; } - List<String> tempFiles; + // Generate a path a temporary filename for output module + String modulePath; + SLANG_RETURN_ON_FAIL(File::generateTemporary(UnownedStringSlice::fromLiteral("slang-generated"), modulePath)); if (!useOriginalFile) { - SLANG_RETURN_ON_FAIL(File::generateTemporary(UnownedStringSlice::fromLiteral("slang-generated"), compileSourcePath)); + // We need to create a new file which has the source. We'll use the module generated name as the basis + compileSourcePath = modulePath; + + // NOTE: Strictly speaking producing filenames by modifying the generateTemporary path that may introduce a temp filename clash, but in practice is extraordinary unlikely + + compileSourcePath.append("-src"); // Make the temporary filename have the appropriate extension. - // NOTE: Strictly speaking that may introduce a temp filename clash, but in practice is extraordinary unlikely if (rawSourceLanguage == SourceLanguage::C) { compileSourcePath.append(".c"); @@ -1376,10 +1382,6 @@ SlangResult dissassembleDXILUsingDXC( // Disable exceptions and security checks options.flags &= ~(CompileOptions::Flag::EnableExceptionHandling | CompileOptions::Flag::EnableSecurityChecks); - // Generate a path a temporary filename for output module - String modulePath; - SLANG_RETURN_ON_FAIL(File::generateTemporary(UnownedStringSlice::fromLiteral("slang-generated"), modulePath)); - // Remove the temporary path/file when done temporaryFileSet.add(modulePath); |
