summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/FileSystemStatCache.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-07-16 19:44:23 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-07-16 19:44:23 +0000
commit16125fb652f25164b16dcf22495babba6c45eca9 (patch)
treedba790ba440f06959431f1a0a6b9b2f405567554 /clang/lib/Basic/FileSystemStatCache.cpp
parent6d35481c94ae2a4118547c93f8f27bd18afa5d93 (diff)
downloadbcm5719-llvm-16125fb652f25164b16dcf22495babba6c45eca9.tar.gz
bcm5719-llvm-16125fb652f25164b16dcf22495babba6c45eca9.zip
Update for llvm API change.
llvm-svn: 186448
Diffstat (limited to 'clang/lib/Basic/FileSystemStatCache.cpp')
-rw-r--r--clang/lib/Basic/FileSystemStatCache.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/clang/lib/Basic/FileSystemStatCache.cpp b/clang/lib/Basic/FileSystemStatCache.cpp
index 38c46299018..b71259e0d5c 100644
--- a/clang/lib/Basic/FileSystemStatCache.cpp
+++ b/clang/lib/Basic/FileSystemStatCache.cpp
@@ -12,8 +12,8 @@
//===----------------------------------------------------------------------===//
#include "clang/Basic/FileSystemStatCache.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
-#include <fcntl.h>
// FIXME: This is terrible, we need this for ::close.
#if !defined(_MSC_VER) && !defined(__MINGW32__)
@@ -60,13 +60,9 @@ bool FileSystemStatCache::get(const char *Path, struct stat &StatBuf,
//
// Because of this, check to see if the file exists with 'open'. If the
// open succeeds, use fstat to get the stat info.
- int OpenFlags = O_RDONLY;
-#ifdef O_BINARY
- OpenFlags |= O_BINARY; // Open input file in binary mode on win32.
-#endif
- *FileDescriptor = ::open(Path, OpenFlags);
-
- if (*FileDescriptor == -1) {
+ llvm::error_code EC = llvm::sys::fs::openFileForRead(Path, *FileDescriptor);
+
+ if (EC) {
// If the open fails, our "stat" fails.
R = CacheMissing;
} else {
OpenPOWER on IntegriCloud