summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/FileManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Basic/FileManager.cpp')
-rw-r--r--clang/lib/Basic/FileManager.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index 649e4d2239b..8e186713a92 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/lib/Basic/FileManager.cpp
@@ -187,10 +187,10 @@ FileManager::getFile(StringRef Filename, bool openFile, bool CacheFailure) {
auto Result = getFileRef(Filename, openFile, CacheFailure);
if (Result)
return &Result->getFileEntry();
- return Result.getError();
+ return llvm::errorToErrorCode(Result.takeError());
}
-llvm::ErrorOr<FileEntryRef>
+llvm::Expected<FileEntryRef>
FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) {
++NumFileLookups;
@@ -199,7 +199,8 @@ FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) {
SeenFileEntries.insert({Filename, std::errc::no_such_file_or_directory});
if (!SeenFileInsertResult.second) {
if (!SeenFileInsertResult.first->second)
- return SeenFileInsertResult.first->second.getError();
+ return llvm::errorCodeToError(
+ SeenFileInsertResult.first->second.getError());
// Construct and return and FileEntryRef, unless it's a redirect to another
// filename.
SeenFileEntryOrRedirect Value = *SeenFileInsertResult.first->second;
@@ -230,7 +231,7 @@ FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) {
else
SeenFileEntries.erase(Filename);
- return DirInfoOrErr.getError();
+ return llvm::errorCodeToError(DirInfoOrErr.getError());
}
const DirectoryEntry *DirInfo = *DirInfoOrErr;
@@ -249,7 +250,7 @@ FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) {
else
SeenFileEntries.erase(Filename);
- return statError;
+ return llvm::errorCodeToError(statError);
}
assert((openFile || !F) && "undesired open file");
OpenPOWER on IntegriCloud