forked from OSchip/llvm-project
[dsymutil] Create the temporary files in the system temp directory.
llvm-dsymutil used to create the temporary files in the output directory. This works fine except when the output directory contains a '%' char, which is then replaced by llvm::sys::fs::createUniqueFile() generating an invalid path. Just use the default temp dir for those files. llvm-svn: 268304
This commit is contained in:
parent
1dccd9da01
commit
bd126df21f
|
@ -24,9 +24,7 @@ CHECK: DW_AT_name{{.*}} "x86_64h_var"
|
|||
|
||||
CHECK: Running lipo
|
||||
CHECK-NEXT: lipo -create
|
||||
CHECK-SAME: [[INPUTS_PATH]]fat-test.dylib.tmp{{......}}.dwarf
|
||||
CHECK-SAME: [[INPUTS_PATH]]fat-test.dylib.tmp{{......}}.dwarf
|
||||
CHECK-SAME: [[INPUTS_PATH]]fat-test.dylib.tmp{{......}}.dwarf
|
||||
CHECK-SAME [[TMP_PATH:.*?]]fat-test.dylib.tmp{{......}}.dwarf [[TMP_PATH]]fat-test.dylib.tmp{{......}}.dwarf [[TMP_PATH]]fat-test.dylib.tmp{{......}}.dwarf
|
||||
CHECK-SAME: -segalign x86_64 20 -segalign i386 20 -segalign x86_64h 20
|
||||
CHECK-SAME: -output [[INPUTS_PATH]]fat-test.dylib.dwarf
|
||||
|
||||
|
|
|
@ -176,14 +176,17 @@ static std::error_code getUniqueFile(const llvm::Twine &Model, int &ResultFD,
|
|||
static std::string getOutputFileName(llvm::StringRef InputFile,
|
||||
bool TempFile = false) {
|
||||
if (TempFile) {
|
||||
llvm::SmallString<128> TmpFile;
|
||||
llvm::sys::path::system_temp_directory(true, TmpFile);
|
||||
llvm::StringRef Basename =
|
||||
OutputFileOpt.empty() ? InputFile : llvm::StringRef(OutputFileOpt);
|
||||
llvm::Twine OutputFile = Basename + ".tmp%%%%%%.dwarf";
|
||||
llvm::sys::path::append(TmpFile, llvm::sys::path::filename(Basename));
|
||||
|
||||
int FD;
|
||||
llvm::SmallString<128> UniqueFile;
|
||||
if (auto EC = getUniqueFile(OutputFile, FD, UniqueFile)) {
|
||||
if (auto EC = getUniqueFile(TmpFile + ".tmp%%%%%.dwarf", FD, UniqueFile)) {
|
||||
llvm::errs() << "error: failed to create temporary outfile '"
|
||||
<< OutputFile << "': " << EC.message() << '\n';
|
||||
<< TmpFile << "': " << EC.message() << '\n';
|
||||
return "";
|
||||
}
|
||||
llvm::sys::RemoveFileOnSignal(UniqueFile);
|
||||
|
|
Loading…
Reference in New Issue