[PATCH] D12711: ScanDirForExecutable on Windows fails to find executables with the "exe" extension in name

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 16:29:30 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL247358: ScanDirForExecutable on Windows fails to find executables with the "exe"… (authored by rnk).

Changed prior to commit:
  http://reviews.llvm.org/D12711?vs=34360&id=34509#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12711

Files:
  llvm/trunk/include/llvm/Support/FileSystem.h
  llvm/trunk/lib/Support/Unix/Path.inc
  llvm/trunk/lib/Support/Windows/Path.inc

Index: llvm/trunk/include/llvm/Support/FileSystem.h
===================================================================
--- llvm/trunk/include/llvm/Support/FileSystem.h
+++ llvm/trunk/include/llvm/Support/FileSystem.h
@@ -378,9 +378,7 @@
 ///
 /// @param Path Input path.
 /// @returns True if we can execute it, false otherwise.
-inline bool can_execute(const Twine &Path) {
-  return !access(Path, AccessMode::Execute);
-}
+bool can_execute(const Twine &Path);
 
 /// @brief Can we write this file?
 ///
Index: llvm/trunk/lib/Support/Unix/Path.inc
===================================================================
--- llvm/trunk/lib/Support/Unix/Path.inc
+++ llvm/trunk/lib/Support/Unix/Path.inc
@@ -325,6 +325,10 @@
   return std::error_code();
 }
 
+bool can_execute(const Twine &Path) {
+  return !access(Path, AccessMode::Execute);
+}
+
 bool equivalent(file_status A, file_status B) {
   assert(status_known(A) && status_known(B));
   return A.fs_st_dev == B.fs_st_dev &&
Index: llvm/trunk/lib/Support/Windows/Path.inc
===================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc
+++ llvm/trunk/lib/Support/Windows/Path.inc
@@ -302,6 +302,11 @@
   return std::error_code();
 }
 
+bool can_execute(const Twine &Path) {
+  return !access(Path, AccessMode::Execute) ||
+         !access(Path + ".exe", AccessMode::Execute);
+}
+
 bool equivalent(file_status A, file_status B) {
   assert(status_known(A) && status_known(B));
   return A.FileIndexHigh      == B.FileIndexHigh &&


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12711.34509.patch
Type: text/x-patch
Size: 1535 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150910/5f8c86dc/attachment.bin>


More information about the llvm-commits mailing list