forked from OSchip/llvm-project
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. llvm-svn: 209952
This commit is contained in:
parent
ec1aacaf5c
commit
03bddfee47
|
@ -744,7 +744,7 @@ ELFFile<ELFT>::ELFFile(MemoryBuffer *Object, error_code &ec)
|
|||
}
|
||||
}
|
||||
|
||||
ec = error_code::success();
|
||||
ec = error_code();
|
||||
}
|
||||
|
||||
// Get the symbol table index in the symtab section given a symbol
|
||||
|
|
|
@ -163,7 +163,7 @@ public:
|
|||
const_reference get() const { return const_cast<ErrorOr<T> >(this)->get(); }
|
||||
|
||||
error_code getError() const {
|
||||
return HasError ? *getErrorStorage() : error_code::success();
|
||||
return HasError ? *getErrorStorage() : error_code();
|
||||
}
|
||||
|
||||
pointer operator ->() {
|
||||
|
|
|
@ -505,7 +505,7 @@ inline error_code file_size(const Twine &Path, uint64_t &Result) {
|
|||
if (EC)
|
||||
return EC;
|
||||
Result = Status.getSize();
|
||||
return error_code::success();
|
||||
return error_code();
|
||||
}
|
||||
|
||||
/// @brief Set the file modification and access time.
|
||||
|
|
|
@ -727,10 +727,6 @@ class error_code {
|
|||
public:
|
||||
error_code() : _val_(0), _cat_(&system_category()) {}
|
||||
|
||||
static error_code success() {
|
||||
return error_code();
|
||||
}
|
||||
|
||||
error_code(int _val, const error_category& _cat)
|
||||
: _val_(_val), _cat_(&_cat) {}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -155,7 +155,7 @@ error_code SectionMemoryManager::applyMemoryGroupPermissions(MemoryGroup &MemGro
|
|||
}
|
||||
}
|
||||
|
||||
return error_code::success();
|
||||
return error_code();
|
||||
}
|
||||
|
||||
void SectionMemoryManager::invalidateInstructionCache() {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
if (Filename == "-") {
|
||||
Fd = 0;
|
||||
sys::ChangeStdinToBinary();
|
||||
return error_code::success();
|
||||
return error_code();
|
||||
}
|
||||
|
||||
return sys::fs::openFileForRead(Filename, Fd);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -208,7 +208,7 @@ Process::GetArgumentVector(SmallVectorImpl<const char *> &Args,
|
|||
if (ec)
|
||||
return ec;
|
||||
|
||||
return error_code::success();
|
||||
return error_code();
|
||||
}
|
||||
|
||||
bool Process::StandardInIsUserInput() {
|
||||
|
|
|
@ -59,7 +59,7 @@ protected:
|
|||
TEST_P(MappedMemoryTest, AllocAndRelease) {
|
||||
error_code EC;
|
||||
MemoryBlock M1 = Memory::allocateMappedMemory(sizeof(int), 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
|
||||
EXPECT_NE((void*)0, M1.base());
|
||||
EXPECT_LE(sizeof(int), M1.size());
|
||||
|
@ -70,11 +70,11 @@ TEST_P(MappedMemoryTest, AllocAndRelease) {
|
|||
TEST_P(MappedMemoryTest, MultipleAllocAndRelease) {
|
||||
error_code EC;
|
||||
MemoryBlock M1 = Memory::allocateMappedMemory(16, 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
MemoryBlock M2 = Memory::allocateMappedMemory(64, 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
MemoryBlock M3 = Memory::allocateMappedMemory(32, 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
|
||||
EXPECT_NE((void*)0, M1.base());
|
||||
EXPECT_LE(16U, M1.size());
|
||||
|
@ -90,7 +90,7 @@ TEST_P(MappedMemoryTest, MultipleAllocAndRelease) {
|
|||
EXPECT_FALSE(Memory::releaseMappedMemory(M1));
|
||||
EXPECT_FALSE(Memory::releaseMappedMemory(M3));
|
||||
MemoryBlock M4 = Memory::allocateMappedMemory(16, 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
EXPECT_NE((void*)0, M4.base());
|
||||
EXPECT_LE(16U, M4.size());
|
||||
EXPECT_FALSE(Memory::releaseMappedMemory(M4));
|
||||
|
@ -105,7 +105,7 @@ TEST_P(MappedMemoryTest, BasicWrite) {
|
|||
|
||||
error_code EC;
|
||||
MemoryBlock M1 = Memory::allocateMappedMemory(sizeof(int), 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
|
||||
EXPECT_NE((void*)0, M1.base());
|
||||
EXPECT_LE(sizeof(int), M1.size());
|
||||
|
@ -124,11 +124,11 @@ TEST_P(MappedMemoryTest, MultipleWrite) {
|
|||
return;
|
||||
error_code EC;
|
||||
MemoryBlock M1 = Memory::allocateMappedMemory(sizeof(int), 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
MemoryBlock M2 = Memory::allocateMappedMemory(8 * sizeof(int), 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
MemoryBlock M3 = Memory::allocateMappedMemory(4 * sizeof(int), 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
|
||||
EXPECT_FALSE(doesOverlap(M1, M2));
|
||||
EXPECT_FALSE(doesOverlap(M2, M3));
|
||||
|
@ -160,7 +160,7 @@ TEST_P(MappedMemoryTest, MultipleWrite) {
|
|||
EXPECT_FALSE(Memory::releaseMappedMemory(M3));
|
||||
|
||||
MemoryBlock M4 = Memory::allocateMappedMemory(64 * sizeof(int), 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
EXPECT_NE((void*)0, M4.base());
|
||||
EXPECT_LE(64U * sizeof(int), M4.size());
|
||||
x = (int*)M4.base();
|
||||
|
@ -178,11 +178,11 @@ TEST_P(MappedMemoryTest, MultipleWrite) {
|
|||
TEST_P(MappedMemoryTest, EnabledWrite) {
|
||||
error_code EC;
|
||||
MemoryBlock M1 = Memory::allocateMappedMemory(2 * sizeof(int), 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
MemoryBlock M2 = Memory::allocateMappedMemory(8 * sizeof(int), 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
MemoryBlock M3 = Memory::allocateMappedMemory(4 * sizeof(int), 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
|
||||
EXPECT_NE((void*)0, M1.base());
|
||||
EXPECT_LE(2U * sizeof(int), M1.size());
|
||||
|
@ -217,10 +217,10 @@ TEST_P(MappedMemoryTest, EnabledWrite) {
|
|||
EXPECT_EQ(6, y[6]);
|
||||
|
||||
MemoryBlock M4 = Memory::allocateMappedMemory(16, 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
EXPECT_NE((void*)0, M4.base());
|
||||
EXPECT_LE(16U, M4.size());
|
||||
EXPECT_EQ(error_code::success(), Memory::protectMappedMemory(M4, getTestableEquivalent(Flags)));
|
||||
EXPECT_EQ(error_code(), Memory::protectMappedMemory(M4, getTestableEquivalent(Flags)));
|
||||
x = (int*)M4.base();
|
||||
*x = 4;
|
||||
EXPECT_EQ(4, *x);
|
||||
|
@ -231,11 +231,11 @@ TEST_P(MappedMemoryTest, EnabledWrite) {
|
|||
TEST_P(MappedMemoryTest, SuccessiveNear) {
|
||||
error_code EC;
|
||||
MemoryBlock M1 = Memory::allocateMappedMemory(16, 0, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
MemoryBlock M2 = Memory::allocateMappedMemory(64, &M1, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
MemoryBlock M3 = Memory::allocateMappedMemory(32, &M2, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
|
||||
EXPECT_NE((void*)0, M1.base());
|
||||
EXPECT_LE(16U, M1.size());
|
||||
|
@ -257,11 +257,11 @@ TEST_P(MappedMemoryTest, DuplicateNear) {
|
|||
error_code EC;
|
||||
MemoryBlock Near((void*)(3*PageSize), 16);
|
||||
MemoryBlock M1 = Memory::allocateMappedMemory(16, &Near, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
MemoryBlock M2 = Memory::allocateMappedMemory(64, &Near, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
MemoryBlock M3 = Memory::allocateMappedMemory(32, &Near, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
|
||||
EXPECT_NE((void*)0, M1.base());
|
||||
EXPECT_LE(16U, M1.size());
|
||||
|
@ -279,11 +279,11 @@ TEST_P(MappedMemoryTest, ZeroNear) {
|
|||
error_code EC;
|
||||
MemoryBlock Near(0, 0);
|
||||
MemoryBlock M1 = Memory::allocateMappedMemory(16, &Near, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
MemoryBlock M2 = Memory::allocateMappedMemory(64, &Near, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
MemoryBlock M3 = Memory::allocateMappedMemory(32, &Near, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
|
||||
EXPECT_NE((void*)0, M1.base());
|
||||
EXPECT_LE(16U, M1.size());
|
||||
|
@ -305,11 +305,11 @@ TEST_P(MappedMemoryTest, ZeroSizeNear) {
|
|||
error_code EC;
|
||||
MemoryBlock Near((void*)(4*PageSize), 0);
|
||||
MemoryBlock M1 = Memory::allocateMappedMemory(16, &Near, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
MemoryBlock M2 = Memory::allocateMappedMemory(64, &Near, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
MemoryBlock M3 = Memory::allocateMappedMemory(32, &Near, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
|
||||
EXPECT_NE((void*)0, M1.base());
|
||||
EXPECT_LE(16U, M1.size());
|
||||
|
@ -331,7 +331,7 @@ TEST_P(MappedMemoryTest, UnalignedNear) {
|
|||
error_code EC;
|
||||
MemoryBlock Near((void*)(2*PageSize+5), 0);
|
||||
MemoryBlock M1 = Memory::allocateMappedMemory(15, &Near, Flags, EC);
|
||||
EXPECT_EQ(error_code::success(), EC);
|
||||
EXPECT_EQ(error_code(), EC);
|
||||
|
||||
EXPECT_NE((void*)0, M1.base());
|
||||
EXPECT_LE(sizeof(int), M1.size());
|
||||
|
|
Loading…
Reference in New Issue