Skip to content

Commit 41c15ce

Browse files
authored
[Driver][NFC][SYCL] Improve file name creation for unique names with save-temps (#5072)
When generating unique names for file name creation when using -save-temps we were always creating the file instead of just creating a name to use. This was causing files to be generated even if we were using -###.
1 parent 2caf555 commit 41c15ce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7405,7 +7405,7 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA,
74057405
std::pair<StringRef, StringRef> Split = CollidingName.split('.');
74067406
std::string UniqueName = GetUniquePath(
74077407
Split.first, types::getTypeTempSuffix(JA.getType(), IsCLMode()));
7408-
return C.addResultFile(C.getArgs().MakeArgString(UniqueName), &JA);
7408+
return C.addTempFile(C.getArgs().MakeArgString(UniqueName));
74097409
}
74107410
}
74117411

@@ -7537,7 +7537,7 @@ std::string Driver::GetTemporaryPath(StringRef Prefix, StringRef Suffix) const {
75377537

75387538
std::string Driver::GetUniquePath(StringRef BaseName, StringRef Ext) const {
75397539
SmallString<128> Path;
7540-
std::error_code EC = llvm::sys::fs::createUniqueFile(
7540+
std::error_code EC = llvm::sys::fs::getPotentiallyUniqueFileName(
75417541
Twine(BaseName) + Twine("-%%%%%%.") + Ext, Path);
75427542
if (EC) {
75437543
Diag(clang::diag::err_unable_to_make_temp) << EC.message();

0 commit comments

Comments
 (0)