diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 | 
| commit | 06d4ba388873e6d1cfa9cd715a8935ecc8cd2097 (patch) | |
| tree | 3eb853da77d46cc77c4b017525a422f9ddb1385b /lib/Basic/FileSystemStatCache.cpp | |
| parent | 30d791273d07fac9c0c1641a0731191bca6e8606 (diff) | |
Notes
Diffstat (limited to 'lib/Basic/FileSystemStatCache.cpp')
| -rw-r--r-- | lib/Basic/FileSystemStatCache.cpp | 9 | 
1 files changed, 4 insertions, 5 deletions
| diff --git a/lib/Basic/FileSystemStatCache.cpp b/lib/Basic/FileSystemStatCache.cpp index 7515cfb440af..83e42bdb8483 100644 --- a/lib/Basic/FileSystemStatCache.cpp +++ b/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. | 
