From d965f95daa97097c8ddc5e1165ceae585a888719 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 16 Jul 2013 19:44:23 +0000 Subject: Update for llvm API change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186448 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/FileSystemStatCache.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lib/Basic/FileSystemStatCache.cpp') diff --git a/lib/Basic/FileSystemStatCache.cpp b/lib/Basic/FileSystemStatCache.cpp index 38c4629901..b71259e0d5 100644 --- a/lib/Basic/FileSystemStatCache.cpp +++ b/lib/Basic/FileSystemStatCache.cpp @@ -12,8 +12,8 @@ //===----------------------------------------------------------------------===// #include "clang/Basic/FileSystemStatCache.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" -#include // 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 { -- cgit v1.2.3