Handle "-" in tryCreateFile.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 8 Nov 2017 23:07:32 +0000 (23:07 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 8 Nov 2017 23:07:32 +0000 (23:07 +0000)
Otherwise we would fail with -M if the we didn't have write
permissions to the current directory.

llvm-svn: 317740

lld/ELF/Filesystem.cpp
lld/test/ELF/driver-access.test

index 1aa3453..a7c25c9 100644 (file)
@@ -80,5 +80,7 @@ void elf::unlinkAsync(StringRef Path) {
 std::error_code elf::tryCreateFile(StringRef Path) {
   if (Path.empty())
     return std::error_code();
+  if (Path == "-")
+    return std::error_code();
   return errorToErrorCode(FileOutputBuffer::create(Path, 1).takeError());
 }
index 5209483..46b87c1 100644 (file)
@@ -7,7 +7,7 @@
 # RUN: mkdir -p %t.dir
 # RUN: chmod 100 %t.dir
 # RUN: cd %t.dir
-# RUN: ld.lld %t.o -o %t.exe
+# RUN: ld.lld %t.o -o %t.exe -M
 # RUN: chmod 755 %t.dir
 
 .globl _start