[llvm] r186345 - Remove an extra is_directory call.

Rafael Espindola rafael.espindola at gmail.com
Mon Jul 15 13:52:01 PDT 2013


Author: rafael
Date: Mon Jul 15 15:52:01 2013
New Revision: 186345

URL: http://llvm.org/viewvc/llvm-project?rev=186345&view=rev
Log:
Remove an extra is_directory call.

I checked that opening a directory on windows does fail, so this saves a "stat".

Modified:
    llvm/trunk/lib/Support/MemoryBuffer.cpp

Modified: llvm/trunk/lib/Support/MemoryBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/MemoryBuffer.cpp?rev=186345&r1=186344&r2=186345&view=diff
==============================================================================
--- llvm/trunk/lib/Support/MemoryBuffer.cpp (original)
+++ llvm/trunk/lib/Support/MemoryBuffer.cpp Mon Jul 15 15:52:01 2013
@@ -253,17 +253,6 @@ error_code MemoryBuffer::getFile(const c
                                  OwningPtr<MemoryBuffer> &result,
                                  int64_t FileSize,
                                  bool RequiresNullTerminator) {
-  // FIXME: Review if this check is unnecessary on windows as well.
-#ifdef LLVM_ON_WIN32
-  // First check that the "file" is not a directory
-  bool is_dir = false;
-  error_code err = sys::fs::is_directory(Filename, is_dir);
-  if (err)
-    return err;
-  if (is_dir)
-    return make_error_code(errc::is_a_directory);
-#endif
-
   int OpenFlags = O_RDONLY;
 #ifdef O_BINARY
   OpenFlags |= O_BINARY;  // Open input file in binary mode on win32.





More information about the llvm-commits mailing list