Skip to content

Commit

Permalink
[SYCL][ClangLinkerWrapper] Make all temp files use different names (#…
Browse files Browse the repository at this point in the history
…14243)

Resolve issue with -save-temps regarding a temp file being linked to
itself.

---------

Co-authored-by: Marcos Maronas <maarquitos14@users.noreply.github.com>
  • Loading branch information
jasonlizhengjian and maarquitos14 authored Jul 2, 2024
1 parent 4a87b2c commit 66a0199
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ Expected<StringRef> createOutputFile(const Twine &Prefix, StringRef Extension) {
std::scoped_lock<decltype(TempFilesMutex)> Lock(TempFilesMutex);
SmallString<128> OutputFile;
if (SaveTemps) {
(Prefix + "." + Extension).toNullTerminatedStringRef(OutputFile);
// Generate a unique path name without creating a file
sys::fs::createUniquePath(Prefix + "-%%%%%%." + Extension, OutputFile,
/*MakeAbsolute=*/false);
} else {
if (std::error_code EC =
sys::fs::createTemporaryFile(Prefix, Extension, OutputFile))
Expand Down

0 comments on commit 66a0199

Please sign in to comment.