summaryrefslogtreecommitdiff
path: root/lib/Support/MemoryBuffer.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-01 22:48:51 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-01 22:48:51 +0000
commit3b05d9f4db3399f524fdf206a22771a87fa321b2 (patch)
treee23c351bf16558ad175e39db7c7f1de82345b07b /lib/Support/MemoryBuffer.cpp
parent21a7e3171bbb46a4fa769ac2d7688214168375c7 (diff)
downloadllvm-3b05d9f4db3399f524fdf206a22771a87fa321b2.tar.gz
llvm-3b05d9f4db3399f524fdf206a22771a87fa321b2.tar.bz2
llvm-3b05d9f4db3399f524fdf206a22771a87fa321b2.tar.xz
In llvm::MemoryBuffer::getFile() remove an unnecessary stat call check.
The sys::fs::is_directory() check is unnecessary because, if the filename is a directory, the function will fail anyway with the same error code returned. Remove the check to avoid an unnecessary stat call. Someone needs to review on windows and see if the check is necessary there or not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176386 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/MemoryBuffer.cpp')
-rw-r--r--lib/Support/MemoryBuffer.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp
index 691b6f5069..4c558b37cf 100644
--- a/lib/Support/MemoryBuffer.cpp
+++ b/lib/Support/MemoryBuffer.cpp
@@ -244,6 +244,8 @@ error_code MemoryBuffer::getFile(const char *Filename,
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);
@@ -251,6 +253,7 @@ error_code MemoryBuffer::getFile(const char *Filename,
return err;
if (is_dir)
return make_error_code(errc::is_a_directory);
+#endif
int OpenFlags = O_RDONLY;
#ifdef O_BINARY