From 68a83539412a280f0d071e30de69f2a5f7320624 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Sat, 31 May 2014 02:23:01 +0000 Subject: [PATCH] Use make_error_code in preparation for making errc an enum class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209956 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/VirtualFileSystem.cpp | 16 ++++++++-------- unittests/Basic/VirtualFileSystemTest.cpp | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/Basic/VirtualFileSystem.cpp b/lib/Basic/VirtualFileSystem.cpp index 1892839e2b..3bca96449d 100644 --- a/lib/Basic/VirtualFileSystem.cpp +++ b/lib/Basic/VirtualFileSystem.cpp @@ -201,7 +201,7 @@ ErrorOr OverlayFileSystem::status(const Twine &Path) { if (Status || Status.getError() != errc::no_such_file_or_directory) return Status; } - return error_code(errc::no_such_file_or_directory, system_category()); + return make_error_code(errc::no_such_file_or_directory); } error_code OverlayFileSystem::openFileForRead(const llvm::Twine &Path, @@ -212,7 +212,7 @@ error_code OverlayFileSystem::openFileForRead(const llvm::Twine &Path, if (!EC || EC != errc::no_such_file_or_directory) return EC; } - return error_code(errc::no_such_file_or_directory, system_category()); + return make_error_code(errc::no_such_file_or_directory); } //===-----------------------------------------------------------------------===/ @@ -744,7 +744,7 @@ ErrorOr VFSFromYAML::lookupPath(const Twine &Path_) { return EC; if (Path.empty()) - return error_code(errc::invalid_argument, system_category()); + return make_error_code(errc::invalid_argument); sys::path::const_iterator Start = sys::path::begin(Path); sys::path::const_iterator End = sys::path::end(Path); @@ -754,7 +754,7 @@ ErrorOr VFSFromYAML::lookupPath(const Twine &Path_) { if (Result || Result.getError() != errc::no_such_file_or_directory) return Result; } - return error_code(errc::no_such_file_or_directory, system_category()); + return make_error_code(errc::no_such_file_or_directory); } ErrorOr VFSFromYAML::lookupPath(sys::path::const_iterator Start, @@ -767,7 +767,7 @@ ErrorOr VFSFromYAML::lookupPath(sys::path::const_iterator Start, if (CaseSensitive ? !Start->equals(From->getName()) : !Start->equals_lower(From->getName())) // failure to match - return error_code(errc::no_such_file_or_directory, system_category()); + return make_error_code(errc::no_such_file_or_directory); ++Start; @@ -778,7 +778,7 @@ ErrorOr VFSFromYAML::lookupPath(sys::path::const_iterator Start, DirectoryEntry *DE = dyn_cast(From); if (!DE) - return error_code(errc::not_a_directory, system_category()); + return make_error_code(errc::not_a_directory); for (DirectoryEntry::iterator I = DE->contents_begin(), E = DE->contents_end(); @@ -787,7 +787,7 @@ ErrorOr VFSFromYAML::lookupPath(sys::path::const_iterator Start, if (Result || Result.getError() != errc::no_such_file_or_directory) return Result; } - return error_code(errc::no_such_file_or_directory, system_category()); + return make_error_code(errc::no_such_file_or_directory); } ErrorOr VFSFromYAML::status(const Twine &Path) { @@ -820,7 +820,7 @@ error_code VFSFromYAML::openFileForRead(const Twine &Path, FileEntry *F = dyn_cast(*E); if (!F) // FIXME: errc::not_a_file? - return error_code(errc::invalid_argument, system_category()); + return make_error_code(errc::invalid_argument); if (error_code EC = ExternalFS->openFileForRead(F->getExternalContentsPath(), Result)) diff --git a/unittests/Basic/VirtualFileSystemTest.cpp b/unittests/Basic/VirtualFileSystemTest.cpp index 40d2f168cd..82b8387538 100644 --- a/unittests/Basic/VirtualFileSystemTest.cpp +++ b/unittests/Basic/VirtualFileSystemTest.cpp @@ -35,7 +35,7 @@ public: std::map::iterator I = FilesAndDirs.find(Path.str()); if (I == FilesAndDirs.end()) - return error_code(errc::no_such_file_or_directory, posix_category()); + return make_error_code(errc::no_such_file_or_directory); return I->second; } error_code openFileForRead(const Twine &Path, -- 2.40.0