summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2016-05-02 21:06:14 +0000
committerFrederic Riss <friss@apple.com>2016-05-02 21:06:14 +0000
commitbd126df21fdbd1338a5e3065f8cca8a1655f99a9 (patch)
treedb76cab06c75c7f7e43170966c151f12b4727b6f /llvm
parent1dccd9da0187abbc7886ad1d1f682f5904a64717 (diff)
downloadbcm5719-llvm-bd126df21fdbd1338a5e3065f8cca8a1655f99a9.tar.gz
bcm5719-llvm-bd126df21fdbd1338a5e3065f8cca8a1655f99a9.zip
[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
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/tools/dsymutil/fat-binary-output.test4
-rw-r--r--llvm/tools/dsymutil/dsymutil.cpp9
2 files changed, 7 insertions, 6 deletions
diff --git a/llvm/test/tools/dsymutil/fat-binary-output.test b/llvm/test/tools/dsymutil/fat-binary-output.test
index fafef14ebe9..94345a893e6 100644
--- a/llvm/test/tools/dsymutil/fat-binary-output.test
+++ b/llvm/test/tools/dsymutil/fat-binary-output.test
@@ -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
diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp
index e9ee57f3dee..aeb0fd2074e 100644
--- a/llvm/tools/dsymutil/dsymutil.cpp
+++ b/llvm/tools/dsymutil/dsymutil.cpp
@@ -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);
OpenPOWER on IntegriCloud