diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-05-31 01:37:45 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-05-31 01:37:45 +0000 |
commit | 1bab2d53996ca082150f34d8dafc1968fb5ecba9 (patch) | |
tree | c1e2d538aa623bb0de93b37a36327a0d6ef2c1de /lib | |
parent | bfe17408a9bcad9cbb29ff0dafb8a7674a7c09a6 (diff) | |
download | llvm-1bab2d53996ca082150f34d8dafc1968fb5ecba9.tar.gz llvm-1bab2d53996ca082150f34d8dafc1968fb5ecba9.tar.bz2 llvm-1bab2d53996ca082150f34d8dafc1968fb5ecba9.tar.xz |
Use error_code() instead of error_code::succes()
There is no std::error_code::success, so this removes much of the noise
in transitioning to std::error_code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209952 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.cpp | 52 | ||||
-rw-r--r-- | lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp | 2 | ||||
-rw-r--r-- | lib/IR/Module.cpp | 4 | ||||
-rw-r--r-- | lib/Object/Archive.cpp | 2 | ||||
-rw-r--r-- | lib/Support/DataStream.cpp | 2 | ||||
-rw-r--r-- | lib/Support/FileOutputBuffer.cpp | 2 | ||||
-rw-r--r-- | lib/Support/MemoryBuffer.cpp | 6 | ||||
-rw-r--r-- | lib/Support/Path.cpp | 26 | ||||
-rw-r--r-- | lib/Support/Unix/Memory.inc | 10 | ||||
-rw-r--r-- | lib/Support/Unix/Path.inc | 42 | ||||
-rw-r--r-- | lib/Support/Unix/Process.inc | 2 | ||||
-rw-r--r-- | lib/Support/Windows/Memory.inc | 14 | ||||
-rw-r--r-- | lib/Support/Windows/Path.inc | 50 | ||||
-rw-r--r-- | lib/Support/Windows/Process.inc | 2 |
14 files changed, 108 insertions, 108 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index a8fd8fab50..3d4ae84dbd 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -490,7 +490,7 @@ error_code BitcodeReader::ParseAttributeBlock() { case BitstreamEntry::Error: return Error(MalformedBlock); case BitstreamEntry::EndBlock: - return error_code::success(); + return error_code(); case BitstreamEntry::Record: // The interesting case. break; @@ -619,7 +619,7 @@ error_code BitcodeReader::ParseAttrKind(uint64_t Code, *Kind = GetAttrFromCode(Code); if (*Kind == Attribute::None) return Error(InvalidValue); - return error_code::success(); + return error_code(); } error_code BitcodeReader::ParseAttributeGroupBlock() { @@ -640,7 +640,7 @@ error_code BitcodeReader::ParseAttributeGroupBlock() { case BitstreamEntry::Error: return Error(MalformedBlock); case BitstreamEntry::EndBlock: - return error_code::success(); + return error_code(); case BitstreamEntry::Record: // The interesting case. break; @@ -731,7 +731,7 @@ error_code BitcodeReader::ParseTypeTableBody() { case BitstreamEntry::EndBlock: if (NumRecords != TypeList.size()) return Error(MalformedBlock); - return error_code::success(); + return error_code(); case BitstreamEntry::Record: // The interesting case. break; @@ -947,7 +947,7 @@ error_code BitcodeReader::ParseValueSymbolTable() { case BitstreamEntry::Error: return Error(MalformedBlock); case BitstreamEntry::EndBlock: - return error_code::success(); + return error_code(); case BitstreamEntry::Record: // The interesting case. break; @@ -1002,7 +1002,7 @@ error_code BitcodeReader::ParseMetadata() { case BitstreamEntry::Error: return Error(MalformedBlock); case BitstreamEntry::EndBlock: - return error_code::success(); + return error_code(); case BitstreamEntry::Record: // The interesting case. break; @@ -1178,7 +1178,7 @@ error_code BitcodeReader::ResolveGlobalAndAliasInits() { FunctionPrefixWorklist.pop_back(); } - return error_code::success(); + return error_code(); } static APInt ReadWideAPInt(ArrayRef<uint64_t> Vals, unsigned TypeBits) { @@ -1212,7 +1212,7 @@ error_code BitcodeReader::ParseConstants() { // Once all the constants have been read, go through and resolve forward // references. ValueList.ResolveConstantForwardRefs(); - return error_code::success(); + return error_code(); case BitstreamEntry::Record: // The interesting case. break; @@ -1642,7 +1642,7 @@ error_code BitcodeReader::ParseUseLists() { case BitstreamEntry::Error: return Error(MalformedBlock); case BitstreamEntry::EndBlock: - return error_code::success(); + return error_code(); case BitstreamEntry::Record: // The interesting case. break; @@ -1682,7 +1682,7 @@ error_code BitcodeReader::RememberAndSkipFunctionBody() { // Skip over the function block for now. if (Stream.SkipBlock()) return Error(InvalidRecord); - return error_code::success(); + return error_code(); } error_code BitcodeReader::GlobalCleanup() { @@ -1711,7 +1711,7 @@ error_code BitcodeReader::GlobalCleanup() { // want lazy deserialization. std::vector<std::pair<GlobalVariable*, unsigned> >().swap(GlobalInits); std::vector<std::pair<GlobalAlias*, unsigned> >().swap(AliasInits); - return error_code::success(); + return error_code(); } error_code BitcodeReader::ParseModule(bool Resume) { @@ -1791,7 +1791,7 @@ error_code BitcodeReader::ParseModule(bool Resume) { // just finish the parse now. if (LazyStreamer && SeenValueSymbolTable) { NextUnreadBit = Stream.GetCurrentBitNo(); - return error_code::success(); + return error_code(); } break; case bitc::USELIST_BLOCK_ID: @@ -2054,7 +2054,7 @@ error_code BitcodeReader::ParseBitcodeInto(Module *M) { // need to understand them all. while (1) { if (Stream.AtEndOfStream()) - return error_code::success(); + return error_code(); BitstreamEntry Entry = Stream.advance(BitstreamCursor::AF_DontAutoprocessAbbrevs); @@ -2063,7 +2063,7 @@ error_code BitcodeReader::ParseBitcodeInto(Module *M) { case BitstreamEntry::Error: return Error(MalformedBlock); case BitstreamEntry::EndBlock: - return error_code::success(); + return error_code(); case BitstreamEntry::SubBlock: switch (Entry.ID) { @@ -2079,7 +2079,7 @@ error_code BitcodeReader::ParseBitcodeInto(Module *M) { if (error_code EC = ParseModule(false)) return EC; if (LazyStreamer) - return error_code::success(); + return error_code(); break; default: if (Stream.SkipBlock()) @@ -2096,7 +2096,7 @@ error_code BitcodeReader::ParseBitcodeInto(Module *M) { if (Stream.getAbbrevIDWidth() == 2 && Entry.ID == 2 && Stream.Read(6) == 2 && Stream.Read(24) == 0xa0a0a && Stream.AtEndOfStream()) - return error_code::success(); + return error_code(); return Error(InvalidRecord); } @@ -2118,7 +2118,7 @@ error_code BitcodeReader::ParseModuleTriple(std::string &Triple) { case BitstreamEntry::Error: return Error(MalformedBlock); case BitstreamEntry::EndBlock: - return error_code::success(); + return error_code(); case BitstreamEntry::Record: // The interesting case. break; @@ -2161,7 +2161,7 @@ error_code BitcodeReader::ParseTriple(std::string &Triple) { case BitstreamEntry::Error: return Error(MalformedBlock); case BitstreamEntry::EndBlock: - return error_code::success(); + return error_code(); case BitstreamEntry::SubBlock: if (Entry.ID == bitc::MODULE_BLOCK_ID) @@ -2193,7 +2193,7 @@ error_code BitcodeReader::ParseMetadataAttachment() { case BitstreamEntry::Error: return Error(MalformedBlock); case BitstreamEntry::EndBlock: - return error_code::success(); + return error_code(); case BitstreamEntry::Record: // The interesting case. break; @@ -3146,7 +3146,7 @@ OutOfRecordLoop: ValueList.shrinkTo(ModuleValueListSize); MDValueList.shrinkTo(ModuleMDValueListSize); std::vector<BasicBlock*>().swap(FunctionBBs); - return error_code::success(); + return error_code(); } /// Find the function body in the bitcode stream @@ -3160,7 +3160,7 @@ error_code BitcodeReader::FindFunctionInStream(Function *F, if (error_code EC = ParseModule(true)) return EC; } - return error_code::success(); + return error_code(); } //===----------------------------------------------------------------------===// @@ -3180,7 +3180,7 @@ error_code BitcodeReader::Materialize(GlobalValue *GV) { Function *F = dyn_cast<Function>(GV); // If it's not a function or is already material, ignore the request. if (!F || !F->isMaterializable()) - return error_code::success(); + return error_code(); DenseMap<Function*, uint64_t>::iterator DFII = DeferredFunctionInfo.find(F); assert(DFII != DeferredFunctionInfo.end() && "Deferred function not found!"); @@ -3208,7 +3208,7 @@ error_code BitcodeReader::Materialize(GlobalValue *GV) { } } - return error_code::success(); + return error_code(); } bool BitcodeReader::isDematerializable(const GlobalValue *GV) const { @@ -3272,7 +3272,7 @@ error_code BitcodeReader::MaterializeModule(Module *M) { UpgradeInstWithTBAATag(InstsWithTBAATag[I]); UpgradeDebugInfo(*M); - return error_code::success(); + return error_code(); } error_code BitcodeReader::InitStream() { @@ -3301,7 +3301,7 @@ error_code BitcodeReader::InitStreamFromBuffer() { StreamFile.reset(new BitstreamReader(BufPtr, BufEnd)); Stream.init(*StreamFile); - return error_code::success(); + return error_code(); } error_code BitcodeReader::InitLazyStream() { @@ -3325,7 +3325,7 @@ error_code BitcodeReader::InitLazyStream() { Bytes->dropLeadingBytes(bitcodeStart - buf); Bytes->setKnownObjectSize(bitcodeEnd - bitcodeStart); } - return error_code::success(); + return error_code(); } namespace { diff --git a/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp b/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp index 9ceaa90b0d..1b7d386adc 100644 --- a/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp +++ b/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp @@ -155,7 +155,7 @@ error_code SectionMemoryManager::applyMemoryGroupPermissions(MemoryGroup &MemGro } } - return error_code::success(); + return error_code(); } void SectionMemoryManager::invalidateInstructionCache() { diff --git a/lib/IR/Module.cpp b/lib/IR/Module.cpp index 5dbed69ca6..91b2d91c62 100644 --- a/lib/IR/Module.cpp +++ b/lib/IR/Module.cpp @@ -396,7 +396,7 @@ void Module::Dematerialize(GlobalValue *GV) { error_code Module::materializeAll() { if (!Materializer) - return error_code::success(); + return error_code(); return Materializer->MaterializeModule(this); } @@ -405,7 +405,7 @@ error_code Module::materializeAllPermanently() { return EC; Materializer.reset(); - return error_code::success(); + return error_code(); } //===----------------------------------------------------------------------===// diff --git a/lib/Object/Archive.cpp b/lib/Object/Archive.cpp index 304ca475e1..77421c7da3 100644 --- a/lib/Object/Archive.cpp +++ b/lib/Object/Archive.cpp @@ -179,7 +179,7 @@ error_code Archive::Child::getMemoryBuffer(std::unique_ptr<MemoryBuffer> &Result .toStringRef(Path) : Name, false)); - return error_code::success(); + return error_code(); } error_code Archive::Child::getAsBinary(std::unique_ptr<Binary> &Result, diff --git a/lib/Support/DataStream.cpp b/lib/Support/DataStream.cpp index eec858416a..299e6c57ae 100644 --- a/lib/Support/DataStream.cpp +++ b/lib/Support/DataStream.cpp @@ -68,7 +68,7 @@ public: if (Filename == "-") { Fd = 0; sys::ChangeStdinToBinary(); - return error_code::success(); + return error_code(); } return sys::fs::openFileForRead(Filename, Fd); diff --git a/lib/Support/FileOutputBuffer.cpp b/lib/Support/FileOutputBuffer.cpp index 49311c29d8..5f74d00c6b 100644 --- a/lib/Support/FileOutputBuffer.cpp +++ b/lib/Support/FileOutputBuffer.cpp @@ -81,7 +81,7 @@ error_code FileOutputBuffer::create(StringRef FilePath, if (Result) MappedFile.release(); - return error_code::success(); + return error_code(); } error_code FileOutputBuffer::commit(int64_t NewSmallerSize) { diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp index 629d8855f3..88d862269f 100644 --- a/lib/Support/MemoryBuffer.cpp +++ b/lib/Support/MemoryBuffer.cpp @@ -228,7 +228,7 @@ static error_code getMemoryBufferForStream(int FD, } while (ReadBytes != 0); Result.reset(MemoryBuffer::getMemBufferCopy(Buffer, BufferName)); - return error_code::success(); + return error_code(); } static error_code getFileAux(const char *Filename, @@ -354,7 +354,7 @@ static error_code getOpenFileImpl(int FD, const char *Filename, Result.reset(new (NamedBufferAlloc(Filename)) MemoryBufferMMapFile( RequiresNullTerminator, FD, MapSize, Offset, EC)); if (!EC) - return error_code::success(); + return error_code(); } MemoryBuffer *Buf = MemoryBuffer::getNewUninitMemBuffer(MapSize, Filename); @@ -394,7 +394,7 @@ static error_code getOpenFileImpl(int FD, const char *Filename, } Result.swap(SB); - return error_code::success(); + return error_code(); } error_code MemoryBuffer::getOpenFile(int FD, const char *Filename, diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp index b8d676f286..76bee47984 100644 --- a/lib/Support/Path.cpp +++ b/lib/Support/Path.cpp @@ -209,7 +209,7 @@ retry_random_path: return EC; } - return error_code::success(); + return error_code(); } case FS_Name: { @@ -219,7 +219,7 @@ retry_random_path: return EC; if (Exists) goto retry_random_path; - return error_code::success(); + return error_code(); } case FS_Dir: { @@ -228,7 +228,7 @@ retry_random_path: goto retry_random_path; return EC; } - return error_code::success(); + return error_code(); } } llvm_unreachable("Invalid Type"); @@ -711,7 +711,7 @@ error_code getUniqueID(const Twine Path, UniqueID &Result) { if (EC) return EC; Result = Status.getUniqueID(); - return error_code::success(); + return error_code(); } error_code createUniqueFile(const Twine &Model, int &ResultFd, @@ -781,7 +781,7 @@ error_code make_absolute(SmallVectorImpl<char> &path) { // Already absolute. if (rootName && rootDirectory) - return error_code::success(); + return error_code(); // All of the following conditions will need the current directory. SmallString<128> current_dir; @@ -793,7 +793,7 @@ error_code make_absolute(SmallVectorImpl<char> &path) { path::append(current_dir, p); // Set path to the result. path.swap(current_dir); - return error_code::success(); + return error_code(); } if (!rootName && rootDirectory) { @@ -802,7 +802,7 @@ error_code make_absolute(SmallVectorImpl<char> &path) { path::append(curDirRootName, p); // Set path to the result. path.swap(curDirRootName); - return error_code::success(); + return error_code(); } if (rootName && !rootDirectory) { @@ -814,7 +814,7 @@ error_code make_absolute(SmallVectorImpl<char> &path) { SmallString<128> res; path::append(res, pRootName, bRootDirectory, bRelativePath, pRelativePath); path.swap(res); - return error_code::success(); + return error_code(); } llvm_unreachable("All rootName and rootDirectory combinations should have " @@ -861,7 +861,7 @@ error_code is_directory(const Twine &path, bool &result) { if (error_code ec = status(path, st)) return ec; result = is_directory(st); - return error_code::success(); + return error_code(); } bool is_regular_file(file_status status) { @@ -873,7 +873,7 @@ error_code is_regular_file(const Twine &path, bool &result) { if (error_code ec = status(path, st)) return ec; result = is_regular_file(st); - return error_code::success(); + return error_code(); } bool is_other(file_status status) { @@ -899,13 +899,13 @@ error_code has_magic(const Twine &path, const Twine &magic, bool &result) { if (ec == errc::value_too_large) { // Magic.size() > file_size(Path). result = false; - return error_code::success(); + return error_code(); } return ec; } result = Magic == Buffer; - return error_code::success(); + return error_code(); } /// @brief Identify the magic in magic. @@ -1047,7 +1047,7 @@ error_code identify_magic(const Twine &path, file_magic &result) { return ec; result = identify_magic(Magic); - return error_code::success(); + return error_code(); } error_code directory_entry::status(file_status &result) const { diff --git a/lib/Support/Unix/Memory.inc b/lib/Support/Unix/Memory.inc index 23b49b75fa..7e02244c72 100644 --- a/lib/Support/Unix/Memory.inc +++ b/lib/Support/Unix/Memory.inc @@ -84,7 +84,7 @@ Memory::allocateMappedMemory(size_t NumBytes, const MemoryBlock *const NearBlock, unsigned PFlags, error_code &EC) { - EC = error_code::success(); + EC = error_code(); if (NumBytes == 0) return MemoryBlock(); @@ -140,7 +140,7 @@ Memory::allocateMappedMemory(size_t NumBytes, error_code Memory::releaseMappedMemory(MemoryBlock &M) { if (M.Address == nullptr || M.Size == 0) - return error_code::success(); + return error_code(); if (0 != ::munmap(M.Address, M.Size)) return error_code(errno, system_category()); @@ -148,13 +148,13 @@ Memory::releaseMappedMemory(MemoryBlock &M) { M.Address = nullptr; M.Size = 0; - return error_code::success(); + return error_code(); } error_code Memory::protectMappedMemory(const MemoryBlock &M, unsigned Flags) { if (M.Address == nullptr || M.Size == 0) - return error_code::success(); + return error_code(); if (!Flags) return error_code(EINVAL, generic_category()); @@ -168,7 +168,7 @@ Memory::protectMappedMemory(const MemoryBlock &M, unsigned Flags) { if (Flags & MF_EXEC) Memory::InvalidateInstructionCache(M.Address, M.Size); - return error_code::success(); + return error_code(); } /// AllocateRWX - Allocate a slab of memory with read/write/execute diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc index c36c865451..2925e6457a 100644 --- a/lib/Support/Unix/Path.inc +++ b/lib/Support/Unix/Path.inc @@ -100,7 +100,7 @@ static error_code TempDir(SmallVectorImpl<char> &result) { result.clear(); StringRef d(dir); result.append(d.begin(), d.end()); - return error_code::success(); + return error_code(); } namespace llvm { @@ -235,7 +235,7 @@ error_code current_path(SmallVectorImpl<char> &result) { !llvm::sys::fs::status(".", DotStatus) && PWDStatus.getUniqueID() == DotStatus.getUniqueID()) { result.append(pwd, pwd + strlen(pwd)); - return error_code::success(); + return error_code(); } #ifdef MAXPATHLEN @@ -257,7 +257,7 @@ error_code current_path(SmallVectorImpl<char> &result) { } result.set_size(strlen(result.data())); - return error_code::success(); + return error_code(); } error_code create_directory(const Twine &path, bool IgnoreExisting) { @@ -269,7 +269,7 @@ error_code create_directory(const Twine &path, bool IgnoreExisting) { return error_code(errno, system_category()); } - return error_code::success(); + return error_code(); } error_code normalize_separators(SmallVectorImpl<char> &Path) { @@ -282,7 +282,7 @@ error_code normalize_separators(SmallVectorImpl<char> &Path) { *PI = '/'; } } - return error_code::success(); + return error_code(); } // Note that we are using symbolic link because hard links are not supported by @@ -297,7 +297,7 @@ error_code create_link(const Twine &to, const Twine &from) { if (::symlink(t.begin(), f.begin()) == -1) return error_code(errno, system_category()); - return error_code::success(); + return error_code(); } error_code remove(const Twine &path, bool IgnoreNonExisting) { @@ -308,7 +308,7 @@ error_code remove(const Twine &path, bool IgnoreNonExisting) { if (lstat(p.begin(), &buf) != 0) { if (errno != errc::no_such_file_or_directory || !IgnoreNonExisting) return error_code(errno, system_category()); - return error_code::success(); + return error_code(); } // Note: this check catches strange situations. In all cases, LLVM should @@ -324,7 +324,7 @@ error_code remove(const Twine &path, bool IgnoreNonExisting) { return error_code(errno, system_category()); } - return error_code::success(); + return error_code(); } error_code rename(const Twine &from, const Twine &to) { @@ -337,7 +337,7 @@ error_code rename(const Twine &from, const Twine &to) { if (::rename(f.begin(), t.begin()) == -1) return error_code(errno, system_category()); - return error_code::success(); + return error_code(); } error_code resize_file(const Twine &path, uint64_t size) { @@ -347,7 +347,7 @@ error_code resize_file(const Twine &path, uint64_t size) { if (::truncate(p.begin(), size) == -1) return error_code(errno, system_category()); - return error_code::success(); + return error_code(); } error_code exists(const Twine &path, bool &result) { @@ -361,7 +361,7 @@ error_code exists(const Twine &path, bool &result) { } else result = true; - return error_code::success(); + return error_code(); } bool can_write(const Twine &Path) { @@ -395,7 +395,7 @@ error_code equivalent(const Twine &A, const Twine &B, bool &result) { if (error_code ec = status(A, fsA)) return ec; if (error_code ec = status(B, fsB)) return ec; result = equivalent(fsA, fsB); - return error_code::success(); + return error_code(); } static error_code fillStatus(int StatRet, const struct stat &Status, @@ -429,7 +429,7 @@ static error_code fillStatus(int StatRet, const struct stat &Status, file_status(Type, Perms, Status.st_dev, Status.st_ino, Status.st_mtime, Status.st_uid, Status.st_gid, Status.st_size); - return error_code::success(); + return error_code(); } error_code status(const Twine &Path, file_status &Result) { @@ -455,7 +455,7 @@ error_code setLastModificationAndAccessTime(int FD, TimeValue Time) { Times[1] = Times[0]; if (::futimens(FD, Times)) return error_code(errno, system_category()); - return error_code::success(); + return error_code(); #elif defined(HAVE_FUTIMES) timeval Times[2]; Times[0].tv_sec = Time.toEpochTime(); @@ -463,7 +463,7 @@ error_code setLastModificationAndAccessTime(int FD, TimeValue Time) { Times[1] = Times[0]; if (::futimes(FD, Times)) return error_code(errno, system_category()); - return error_code::success(); + return error_code(); #else #warning Missing futimes() and futimens() return make_error_code(errc::not_supported); @@ -497,7 +497,7 @@ error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset) { Mapping = ::mmap(nullptr, Size, prot, flags, FD, Offset); if (Mapping == MAP_FAILED) return error_code(errno, system_category()); - return error_code::success(); + return error_code(); } mapped_file_region::mapped_file_region(const Twine &path, @@ -602,7 +602,7 @@ error_code detail::directory_iterator_destruct(detail::DirIterState &it) { ::closedir(reinterpret_cast<DIR *>(it.IterationHandle)); it.IterationHandle = 0; it.CurrentEntry = directory_entry(); - return error_code::success(); + return error_code(); } error_code detail::directory_iterator_increment(detail::DirIterState &it) { @@ -619,7 +619,7 @@ error_code detail::directory_iterator_increment(detail::DirIterState &it) { } else return directory_iterator_destruct(it); - return error_code::success(); + return error_code(); } error_code get_magic(const Twine &path, uint32_t len, @@ -650,7 +650,7 @@ error_code get_magic(const Twine &path, uint32_t len, } std::fclose(file); result.set_size(size); - return error_code::success(); + return error_code(); } error_code openFileForRead(const Twine &Name, int &ResultFD) { @@ -660,7 +660,7 @@ error_code openFileForRead(const Twine &Name, int &ResultFD) { if (errno != EINTR) return error_code(errno, system_category()); } - return error_code::success(); + return error_code(); } error_code openFileForWrite(const Twine &Name, int &ResultFD, @@ -690,7 +690,7 @@ error_code openFileForWrite(const Twine &Name, int &ResultFD, if (errno != EINTR) return error_code(errno, system_category()); } - return error_code::success(); + return error_code(); } } // end namespace fs diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc index 8faa638ec8..d927bb539e 100644 --- a/lib/Support/Unix/Process.inc +++ b/lib/Support/Unix/Process.inc @@ -195,7 +195,7 @@ error_code Process::GetArgumentVector(SmallVectorImpl<const char *> &ArgsOut, SpecificBumpPtrAllocator<char> &) { ArgsOut.append(ArgsIn.begin(), ArgsIn.end()); - return error_code::success(); + return error_code(); } bool Process::StandardInIsUserInput() { diff --git a/lib/Support/Windows/Memory.inc b/lib/Support/Windows/Memory.inc index ebe78782b9..a5f1c14b69 100644 --- a/lib/Support/Windows/Memory.inc +++ b/lib/Support/Windows/Memory.inc @@ -70,7 +70,7 @@ MemoryBlock Memory::allocateMappedMemory(size_t NumBytes, const MemoryBlock *const NearBlock, unsigned Flags, error_code &EC) { - EC = error_code::success(); + EC = error_code(); if (NumBytes == 0) return MemoryBlock(); @@ -115,7 +115,7 @@ MemoryBlock Memory::allocateMappedMemory(size_t NumBytes, error_code Memory::releaseMappedMemory(MemoryBlock &M) { if (M.Address == 0 || M.Size == 0) - return error_code::success(); + return error_code(); if (!VirtualFree(M.Address, 0, MEM_RELEASE)) return error_code(::GetLastError(), system_category()); @@ -123,13 +123,13 @@ error_code Memory::releaseMappedMemory(MemoryBlock &M) { M.Address = 0; M.Size = 0; - return error_code::success(); + return error_code(); } error_code Memory::protectMappedMemory(const MemoryBlock &M, unsigned Flags) { if (M.Address == 0 || M.Size == 0) - return error_code::success(); + return error_code(); DWORD Protect = getWindowsProtectionFlags(Flags); @@ -140,7 +140,7 @@ error_code Memory::protectMappedMemory(const MemoryBlock &M, if (Flags & MF_EXEC) Memory::InvalidateInstructionCache(M.Address, M.Size); - return error_code::success(); + return error_code(); } /// InvalidateInstructionCache - Before the JIT can run a block of code @@ -159,7 +159,7 @@ MemoryBlock Memory::AllocateRWX(size_t NumBytes, error_code EC; MB = allocateMappedMemory(NumBytes, NearBlock, MF_READ|MF_WRITE|MF_EXEC, EC); - if (EC != error_code::success() && ErrMsg) { + if (EC != error_code() && ErrMsg) { MakeErrMsg(ErrMsg, EC.message()); } return MB; @@ -167,7 +167,7 @@ MemoryBlock Memory::AllocateRWX(size_t NumBytes, bool Memory::ReleaseRWX(MemoryBlock &M, std::string *ErrMsg) { error_code EC = releaseMappedMemory(M); - if (EC == error_code::success()) + if (EC == error_code()) return false; MakeErrMsg(ErrMsg, EC.message()); return true; diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc index 28eec109f5..8baa263cb8 100644 --- a/lib/Support/Windows/Path.inc +++ b/lib/Support/Windows/Path.inc @@ -155,12 +155,12 @@ error_code create_directory(const Twine &path, bool IgnoreExisting) { return ec; } - return error_code::success(); + return error_code(); } error_code normalize_separators(SmallVectorImpl<char> &Path) { (void) Path; - return error_code::success(); + return error_code(); } // We can't use symbolic links for windows. @@ -180,7 +180,7 @@ error_code create_link(const Twine &to, const Twine &from) { if (!::CreateHardLinkW(wide_from.begin(), wide_to.begin(), NULL)) return windows_error(::GetLastError()); - return error_code::success(); + return error_code(); } error_code remove(const Twine &path, bool IgnoreNonExisting) { @@ -191,7 +191,7 @@ error_code remove(const Twine &path, bool IgnoreNonExisting) { if (error_code EC = status(path, ST)) { if (EC != errc::no_such_file_or_directory || !IgnoreNonExisting) return EC; - return error_code::success(); + return error_code(); } if (error_code ec = UTF8ToUTF16(path.toStringRef(path_storage), @@ -204,14 +204,14 @@ error_code remove(const Twine &path, bool IgnoreNonExisting) { if (EC != errc::no_such_file_or_directory || !IgnoreNonExisting) return EC; } - return error_code::success(); + return error_code(); } if (!::DeleteFileW(c_str(path_utf16))) { error_code EC = windows_error(::GetLastError()); if (EC != errc::no_such_file_or_directory || !IgnoreNonExisting) return EC; } - return error_code::success(); + return error_code(); } error_code rename(const Twine &from, const Twine &to) { @@ -227,11 +227,11 @@ error_code rename(const Twine &from, const Twine &to) { if (error_code ec = UTF8ToUTF16(f, wide_from)) return ec; if (error_code ec = UTF8ToUTF16(t, wide_to)) return ec; - error_code ec = error_code::success(); + error_code ec = error_code(); for (int i = 0; i < 2000; i++) { if (::MoveFileExW(wide_from.begin(), wide_to.begin(), MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) - return error_code::success(); + return error_code(); ec = windows_error(::GetLastError()); if (ec != windows_error::access_denied) break; @@ -283,7 +283,7 @@ error_code exists(const Twine &path, bool &result) { result = false; } else result = true; - return error_code::success(); + return error_code(); } bool can_write(const Twine &Path) { @@ -325,7 +325,7 @@ error_code equivalent(const Twine &A, const Twine &B, bool &result) { if (error_code ec = status(A, fsA)) return ec; if (error_code ec = status(B, fsB)) return ec; result = equivalent(fsA, fsB); - return error_code::success(); + return error_code(); } static bool isReservedName(StringRef path) { @@ -363,16 +363,16 @@ static error_code getStatus(HANDLE FileHandle, file_status &Result) { if (Err != NO_ERROR) return windows_error(Err); Result = file_status(file_type::type_unknown); - return error_code::success(); + return error_code(); } case FILE_TYPE_DISK: break; case FILE_TYPE_CHAR: Result = file_status(file_type::character_file); - return error_code::success(); + return error_code(); case FILE_TYPE_PIPE: Result = file_status(file_type::fifo_file); - return error_code::success(); + return error_code(); } BY_HANDLE_FILE_INFORMATION Info; @@ -388,7 +388,7 @@ static error_code getStatus(HANDLE FileHandle, file_status &Result) { Info.ftLastWriteTime.dwLowDateTime, Info.dwVolumeSerialNumber, Info.nFileSizeHigh, Info.nFileSizeLow, Info.nFileIndexHigh, Info.nFileIndexLow); - return error_code::success(); + return error_code(); } handle_status_error: @@ -410,7 +410,7 @@ error_code status(const Twine &path, file_status &result) { StringRef path8 = path.toStringRef(path_storage); if (isReservedName(path8)) { result = file_status(file_type::character_file); - return error_code::success(); + return error_code(); } if (error_code ec = UTF8ToUTF16(path8, path_utf16)) @@ -458,7 +458,7 @@ error_code setLastModificationAndAccessTime(int FD, TimeValue Time) { HANDLE FileHandle = reinterpret_cast<HANDLE>(_get_osfhandle(FD)); if (!SetFileTime(FileHandle, NULL, &FT, &FT)) return windows_error(::GetLastError()); - return error_code::success(); + return error_code(); } error_code get_magic(const Twine &path, uint32_t len, @@ -500,7 +500,7 @@ error_code get_magic(const Twine &path, uint32_t len, } result.set_size(len); - return error_code::success(); + return error_code(); } error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset) { @@ -584,7 +584,7 @@ error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset) { _close(FileDescriptor); // Also closes FileHandle. } else ::CloseHandle(FileHandle); - return error_code::success(); + return error_code(); } mapped_file_region::mapped_file_region(const Twine &path, @@ -753,7 +753,7 @@ error_code detail::directory_iterator_construct(detail::DirIterState &it, path::append(directory_entry_path, directory_entry_name_utf8.str()); it.CurrentEntry = directory_entry(directory_entry_path.str()); - return error_code::success(); + return error_code(); } error_code detail::directory_iterator_destruct(detail::DirIterState &it) { @@ -762,7 +762,7 @@ error_code detail::directory_iterator_destruct(detail::DirIterState &it) { ScopedFindHandle close(HANDLE(it.IterationHandle)); it.IterationHandle = 0; it.CurrentEntry = directory_entry(); - return error_code::success(); + return error_code(); } error_code detail::directory_iterator_increment(detail::DirIterState &it) { @@ -788,7 +788,7 @@ error_code detail::directory_iterator_increment(detail::DirIterState &it) { return ec; it.CurrentEntry.replace_filename(Twine(directory_entry_path_utf8)); - return error_code::success(); + return error_code(); } error_code openFileForRead(const Twine &Name, int &ResultFD) { @@ -821,7 +821,7 @@ error_code openFileForRead(const Twine &Name, int &ResultFD) { } ResultFD = FD; - return error_code::success(); + return error_code(); } error_code openFileForWrite(const Twine &Name, int &ResultFD, @@ -879,7 +879,7 @@ error_code openFileForWrite(const Twine &Name, int &ResultFD, } ResultFD = FD; - return error_code::success(); + return error_code(); } } // end namespace fs @@ -923,7 +923,7 @@ llvm::error_code UTF8ToUTF16(llvm::StringRef utf8, utf16.push_back(0); utf16.pop_back(); - return llvm::error_code::success(); + return llvm::error_code(); } llvm::error_code UTF16ToUTF8(const wchar_t *utf16, size_t utf16_len, @@ -951,7 +951,7 @@ llvm::error_code UTF16ToUTF8(const wchar_t *utf16, size_t utf16_len, utf8.push_back(0); utf8.pop_back(); - return llvm::error_code::success(); + return llvm::error_code(); } } // end namespace windows } // end namespace sys diff --git a/lib/Support/Windows/Process.inc b/lib/Support/Windows/Process.inc index c3df801dc0..5e3fd7ecdc 100644 --- a/lib/Support/Windows/Process.inc +++ b/lib/Support/Windows/Process.inc @@ -208,7 +208,7 @@ Process::GetArgumentVector(SmallVectorImpl<const char *> &Args, if (ec) return ec; - return error_code::success(); + return error_code(); } bool Process::StandardInIsUserInput() { |