summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/FileSystemStatCache.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-10-26 22:44:13 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-10-26 22:44:13 +0000
commita885796d5fd85e4c7c71407feb48553ef7d4e258 (patch)
tree91527c022eee45fa040d87d150e55b16c515c549 /clang/lib/Basic/FileSystemStatCache.cpp
parent789d29df34169e21d40bd8581c303e1b3a29f6d2 (diff)
downloadbcm5719-llvm-a885796d5fd85e4c7c71407feb48553ef7d4e258.tar.gz
bcm5719-llvm-a885796d5fd85e4c7c71407feb48553ef7d4e258.zip
Make VFS and FileManager match the current MemoryBuffer API.
This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
Diffstat (limited to 'clang/lib/Basic/FileSystemStatCache.cpp')
-rw-r--r--clang/lib/Basic/FileSystemStatCache.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/Basic/FileSystemStatCache.cpp b/clang/lib/Basic/FileSystemStatCache.cpp
index 7515cfb440a..83e42bdb848 100644
--- a/clang/lib/Basic/FileSystemStatCache.cpp
+++ b/clang/lib/Basic/FileSystemStatCache.cpp
@@ -78,21 +78,20 @@ bool FileSystemStatCache::get(const char *Path, FileData &Data, bool isFile,
//
// Because of this, check to see if the file exists with 'open'. If the
// open succeeds, use fstat to get the stat info.
- std::unique_ptr<vfs::File> OwnedFile;
- std::error_code EC = FS.openFileForRead(Path, OwnedFile);
+ auto OwnedFile = FS.openFileForRead(Path);
- if (EC) {
+ if (!OwnedFile) {
// If the open fails, our "stat" fails.
R = CacheMissing;
} else {
// Otherwise, the open succeeded. Do an fstat to get the information
// about the file. We'll end up returning the open file descriptor to the
// client to do what they please with it.
- llvm::ErrorOr<vfs::Status> Status = OwnedFile->status();
+ llvm::ErrorOr<vfs::Status> Status = (*OwnedFile)->status();
if (Status) {
R = CacheExists;
copyStatusToFileData(*Status, Data);
- *F = std::move(OwnedFile);
+ *F = std::move(*OwnedFile);
} else {
// fstat rarely fails. If it does, claim the initial open didn't
// succeed.
OpenPOWER on IntegriCloud