mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 17:32:36 +00:00
Make the Error class constructor protected
This is forcing to use Error::success(), which is in a wide majority of cases a lot more readable. Differential Revision: https://reviews.llvm.org/D26481 llvm-svn: 286561
This commit is contained in:
parent
4ae83cd009
commit
3d0dd0ec2c
@ -589,7 +589,7 @@ public:
|
||||
/// Channel is the ChannelT instance to communicate on. It is assumed that
|
||||
/// the channel is ready to be read from and written to.
|
||||
static Expected<OrcRemoteTargetClient> Create(ChannelT &Channel) {
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
OrcRemoteTargetClient H(Channel, Err);
|
||||
if (Err)
|
||||
return std::move(Err);
|
||||
@ -808,7 +808,7 @@ private:
|
||||
static Error doNothing() { return Error::success(); }
|
||||
|
||||
ChannelT &Channel;
|
||||
Error ExistingError;
|
||||
Error ExistingError = Error::success();
|
||||
std::string RemoteTargetTriple;
|
||||
uint32_t RemotePointerSize = 0;
|
||||
uint32_t RemotePageSize = 0;
|
||||
|
@ -149,14 +149,14 @@ class LLVM_NODISCARD Error {
|
||||
// error.
|
||||
template <typename T> friend class Expected;
|
||||
|
||||
public:
|
||||
protected:
|
||||
/// Create a success value. Prefer using 'Error::success()' for readability
|
||||
/// where possible.
|
||||
Error() : Payload(nullptr) {
|
||||
setPtr(nullptr);
|
||||
setChecked(false);
|
||||
}
|
||||
|
||||
public:
|
||||
/// Create a success value. This is equivalent to calling the default
|
||||
/// constructor, but should be preferred for readability where possible.
|
||||
static Error success() { return Error(); }
|
||||
|
@ -437,7 +437,7 @@ Error LTO::addThinLTO(std::unique_ptr<InputFile> Input,
|
||||
assert(ResI == Res.end());
|
||||
|
||||
ThinLTO.ModuleMap[MBRef.getBufferIdentifier()] = MBRef;
|
||||
return Error();
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
unsigned LTO::getMaxTasks() const {
|
||||
@ -489,7 +489,7 @@ Error LTO::runRegularLTO(AddStreamFn AddStream) {
|
||||
|
||||
if (Conf.PreOptModuleHook &&
|
||||
!Conf.PreOptModuleHook(0, *RegularLTO.CombinedModule))
|
||||
return Error();
|
||||
return Error::success();
|
||||
|
||||
if (!Conf.CodeGenOnly) {
|
||||
for (const auto &R : GlobalResolutions) {
|
||||
@ -512,7 +512,7 @@ Error LTO::runRegularLTO(AddStreamFn AddStream) {
|
||||
|
||||
if (Conf.PostInternalizeModuleHook &&
|
||||
!Conf.PostInternalizeModuleHook(0, *RegularLTO.CombinedModule))
|
||||
return Error();
|
||||
return Error::success();
|
||||
}
|
||||
return backend(Conf, AddStream, RegularLTO.ParallelCodeGenParallelismLevel,
|
||||
std::move(RegularLTO.CombinedModule));
|
||||
@ -593,7 +593,7 @@ public:
|
||||
if (AddStreamFn CacheAddStream = Cache(Task, Key))
|
||||
return RunThinBackend(CacheAddStream);
|
||||
|
||||
return Error();
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error start(
|
||||
@ -628,7 +628,7 @@ public:
|
||||
MBRef, std::ref(CombinedIndex), std::ref(ImportList),
|
||||
std::ref(ExportList), std::ref(ResolvedODR), std::ref(DefinedGlobals),
|
||||
std::ref(ModuleMap));
|
||||
return Error();
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error wait() override {
|
||||
@ -636,7 +636,7 @@ public:
|
||||
if (Err)
|
||||
return std::move(*Err);
|
||||
else
|
||||
return Error();
|
||||
return Error::success();
|
||||
}
|
||||
};
|
||||
|
||||
@ -722,10 +722,10 @@ public:
|
||||
if (ShouldEmitImportsFiles)
|
||||
return errorCodeToError(
|
||||
EmitImportsFiles(ModulePath, NewModulePath + ".imports", ImportList));
|
||||
return Error();
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error wait() override { return Error(); }
|
||||
Error wait() override { return Error::success(); }
|
||||
};
|
||||
|
||||
ThinBackend lto::createWriteIndexesThinBackend(std::string OldPrefix,
|
||||
@ -744,10 +744,10 @@ ThinBackend lto::createWriteIndexesThinBackend(std::string OldPrefix,
|
||||
Error LTO::runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache,
|
||||
bool HasRegularLTO) {
|
||||
if (ThinLTO.ModuleMap.empty())
|
||||
return Error();
|
||||
return Error::success();
|
||||
|
||||
if (Conf.CombinedIndexHook && !Conf.CombinedIndexHook(ThinLTO.CombinedIndex))
|
||||
return Error();
|
||||
return Error::success();
|
||||
|
||||
// Collect for each module the list of function it defines (GUID ->
|
||||
// Summary).
|
||||
|
@ -105,7 +105,7 @@ Error Config::addSaveTemps(std::string OutputFileName,
|
||||
return true;
|
||||
};
|
||||
|
||||
return Error();
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
namespace {
|
||||
@ -302,7 +302,7 @@ Error lto::backend(Config &C, AddStreamFn AddStream,
|
||||
|
||||
if (!C.CodeGenOnly)
|
||||
if (!opt(C, TM.get(), 0, *Mod, /*IsThinLto=*/false))
|
||||
return Error();
|
||||
return Error::success();
|
||||
|
||||
if (ParallelCodeGenParallelismLevel == 1) {
|
||||
codegen(C, TM.get(), AddStream, 0, *Mod);
|
||||
@ -310,7 +310,7 @@ Error lto::backend(Config &C, AddStreamFn AddStream,
|
||||
splitCodeGen(C, TM.get(), AddStream, ParallelCodeGenParallelismLevel,
|
||||
std::move(Mod));
|
||||
}
|
||||
return Error();
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error lto::thinBackend(Config &Conf, unsigned Task, AddStreamFn AddStream,
|
||||
@ -329,25 +329,25 @@ Error lto::thinBackend(Config &Conf, unsigned Task, AddStreamFn AddStream,
|
||||
|
||||
if (Conf.CodeGenOnly) {
|
||||
codegen(Conf, TM.get(), AddStream, Task, Mod);
|
||||
return Error();
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
if (Conf.PreOptModuleHook && !Conf.PreOptModuleHook(Task, Mod))
|
||||
return Error();
|
||||
return Error::success();
|
||||
|
||||
renameModuleForThinLTO(Mod, CombinedIndex);
|
||||
|
||||
thinLTOResolveWeakForLinkerModule(Mod, DefinedGlobals);
|
||||
|
||||
if (Conf.PostPromoteModuleHook && !Conf.PostPromoteModuleHook(Task, Mod))
|
||||
return Error();
|
||||
return Error::success();
|
||||
|
||||
if (!DefinedGlobals.empty())
|
||||
thinLTOInternalizeModule(Mod, DefinedGlobals);
|
||||
|
||||
if (Conf.PostInternalizeModuleHook &&
|
||||
!Conf.PostInternalizeModuleHook(Task, Mod))
|
||||
return Error();
|
||||
return Error::success();
|
||||
|
||||
auto ModuleLoader = [&](StringRef Identifier) {
|
||||
assert(Mod.getContext().isODRUniquingDebugTypes() &&
|
||||
@ -363,11 +363,11 @@ Error lto::thinBackend(Config &Conf, unsigned Task, AddStreamFn AddStream,
|
||||
return Err;
|
||||
|
||||
if (Conf.PostImportModuleHook && !Conf.PostImportModuleHook(Task, Mod))
|
||||
return Error();
|
||||
return Error::success();
|
||||
|
||||
if (!opt(Conf, TM.get(), Task, Mod, /*IsThinLto=*/true))
|
||||
return Error();
|
||||
return Error::success();
|
||||
|
||||
codegen(Conf, TM.get(), AddStream, Task, Mod);
|
||||
return Error();
|
||||
return Error::success();
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ Expected<Archive::Child> Archive::Child::getNext() const {
|
||||
return malformedError(Msg + NameOrErr.get());
|
||||
}
|
||||
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
Child Ret(Parent, NextLoc, &Err);
|
||||
if (Err)
|
||||
return std::move(Err);
|
||||
@ -508,7 +508,7 @@ Archive::Child::getAsBinary(LLVMContext *Context) const {
|
||||
}
|
||||
|
||||
Expected<std::unique_ptr<Archive>> Archive::create(MemoryBufferRef Source) {
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
std::unique_ptr<Archive> Ret(new Archive(Source, Err));
|
||||
if (Err)
|
||||
return std::move(Err);
|
||||
@ -830,7 +830,7 @@ Expected<Archive::Child> Archive::Symbol::getMember() const {
|
||||
}
|
||||
|
||||
const char *Loc = Parent->getData().begin() + Offset;
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
Child C(Parent, Loc, &Err);
|
||||
if (Err)
|
||||
return std::move(Err);
|
||||
|
@ -79,18 +79,17 @@ const std::error_category &object::object_category() {
|
||||
|
||||
llvm::Error llvm::object::isNotObjectErrorInvalidFileType(llvm::Error Err) {
|
||||
if (auto Err2 =
|
||||
handleErrors(std::move(Err),
|
||||
[](std::unique_ptr<ECError> M) {
|
||||
// Try to handle 'M'. If successful, return a success value from
|
||||
// the handler.
|
||||
if (M->convertToErrorCode() == object_error::invalid_file_type)
|
||||
return Error::success();
|
||||
handleErrors(std::move(Err), [](std::unique_ptr<ECError> M) -> Error {
|
||||
// Try to handle 'M'. If successful, return a success value from
|
||||
// the handler.
|
||||
if (M->convertToErrorCode() == object_error::invalid_file_type)
|
||||
return Error::success();
|
||||
|
||||
// We failed to handle 'M' - return it from the handler.
|
||||
// This value will be passed back from catchErrors and
|
||||
// wind up in Err2, where it will be returned from this function.
|
||||
return Error(std::move(M));
|
||||
}))
|
||||
// We failed to handle 'M' - return it from the handler.
|
||||
// This value will be passed back from catchErrors and
|
||||
// wind up in Err2, where it will be returned from this function.
|
||||
return Error(std::move(M));
|
||||
}))
|
||||
return Err2;
|
||||
return Err;
|
||||
}
|
||||
|
@ -1073,7 +1073,7 @@ Expected<std::unique_ptr<MachOObjectFile>>
|
||||
MachOObjectFile::create(MemoryBufferRef Object, bool IsLittleEndian,
|
||||
bool Is64Bits, uint32_t UniversalCputype,
|
||||
uint32_t UniversalIndex) {
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
std::unique_ptr<MachOObjectFile> Obj(
|
||||
new MachOObjectFile(std::move(Object), IsLittleEndian,
|
||||
Is64Bits, Err, UniversalCputype,
|
||||
|
@ -107,7 +107,7 @@ void MachOUniversalBinary::anchor() { }
|
||||
|
||||
Expected<std::unique_ptr<MachOUniversalBinary>>
|
||||
MachOUniversalBinary::create(MemoryBufferRef Source) {
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
std::unique_ptr<MachOUniversalBinary> Ret(
|
||||
new MachOUniversalBinary(Source, Err));
|
||||
if (Err)
|
||||
|
@ -648,7 +648,7 @@ BinaryCoverageReader::create(std::unique_ptr<MemoryBuffer> &ObjectBuffer,
|
||||
StringRef Coverage;
|
||||
uint8_t BytesInAddress;
|
||||
support::endianness Endian;
|
||||
Error E;
|
||||
Error E = Error::success();
|
||||
consumeError(std::move(E));
|
||||
if (ObjectBuffer->getBuffer().startswith(TestingFormatMagic))
|
||||
// This is a special format used for testing.
|
||||
|
@ -100,7 +100,7 @@ ErrorOr<std::vector<MemoryBufferRef>> BinaryHolder::GetArchiveMemberBuffers(
|
||||
Buffers.reserve(CurrentArchives.size());
|
||||
|
||||
for (const auto &CurrentArchive : CurrentArchives) {
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto Child : CurrentArchive->children(Err)) {
|
||||
if (auto NameOrErr = Child.getName()) {
|
||||
if (*NameOrErr == Filename) {
|
||||
|
@ -423,7 +423,7 @@ static void performReadOperation(ArchiveOperation Operation,
|
||||
|
||||
bool Filter = !Members.empty();
|
||||
{
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : OldArchive->children(Err)) {
|
||||
Expected<StringRef> NameOrErr = C.getName();
|
||||
failIfError(NameOrErr.takeError());
|
||||
@ -551,7 +551,7 @@ computeNewArchiveMembers(ArchiveOperation Operation,
|
||||
int InsertPos = -1;
|
||||
StringRef PosName = sys::path::filename(RelPos);
|
||||
if (OldArchive) {
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &Child : OldArchive->children(Err)) {
|
||||
int Pos = Ret.size();
|
||||
Expected<StringRef> NameOrErr = Child.getName();
|
||||
@ -723,7 +723,7 @@ static int performOperation(ArchiveOperation Operation,
|
||||
fail("error opening '" + ArchiveName + "': " + EC.message() + "!");
|
||||
|
||||
if (!EC) {
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
object::Archive Archive(Buf.get()->getMemBufferRef(), Err);
|
||||
EC = errorToErrorCode(std::move(Err));
|
||||
failIfError(EC,
|
||||
@ -785,7 +785,7 @@ static void runMRIScript() {
|
||||
Archives.push_back(std::move(*LibOrErr));
|
||||
object::Archive &Lib = *Archives.back();
|
||||
{
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &Member : Lib.children(Err))
|
||||
addMember(NewMembers, Member);
|
||||
failIfError(std::move(Err));
|
||||
|
@ -490,7 +490,7 @@ static void dumpCXXData(const ObjectFile *Obj) {
|
||||
}
|
||||
|
||||
static void dumpArchive(const Archive *Arc) {
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &ArcC : Arc->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr = ArcC.getAsBinary();
|
||||
if (!ChildOrErr) {
|
||||
|
@ -364,7 +364,7 @@ static Error handleCompressedSection(
|
||||
std::deque<SmallString<32>> &UncompressedSections, StringRef &Name,
|
||||
StringRef &Contents) {
|
||||
if (!Name.startswith("zdebug_"))
|
||||
return Error();
|
||||
return Error::success();
|
||||
UncompressedSections.emplace_back();
|
||||
uint64_t OriginalSize;
|
||||
if (!zlib::isAvailable())
|
||||
@ -377,7 +377,7 @@ static Error handleCompressedSection(
|
||||
.str());
|
||||
Name = Name.substr(1);
|
||||
Contents = UncompressedSections.back();
|
||||
return Error();
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
static Error handleSection(
|
||||
@ -392,10 +392,10 @@ static Error handleSection(
|
||||
StringRef &AbbrevSection, StringRef &CurCUIndexSection,
|
||||
StringRef &CurTUIndexSection) {
|
||||
if (Section.isBSS())
|
||||
return Error();
|
||||
return Error::success();
|
||||
|
||||
if (Section.isVirtual())
|
||||
return Error();
|
||||
return Error::success();
|
||||
|
||||
StringRef Name;
|
||||
if (std::error_code Err = Section.getName(Name))
|
||||
@ -412,7 +412,7 @@ static Error handleSection(
|
||||
|
||||
auto SectionPair = KnownSections.find(Name);
|
||||
if (SectionPair == KnownSections.end())
|
||||
return Error();
|
||||
return Error::success();
|
||||
|
||||
if (DWARFSectionKind Kind = SectionPair->second.second) {
|
||||
auto Index = Kind - DW_SECT_INFO;
|
||||
@ -449,7 +449,7 @@ static Error handleSection(
|
||||
Out.SwitchSection(OutSection);
|
||||
Out.EmitBytes(Contents);
|
||||
}
|
||||
return Error();
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
static Error
|
||||
@ -600,7 +600,7 @@ static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
|
||||
writeIndex(Out, MCOFI.getDwarfCUIndexSection(), ContributionOffsets,
|
||||
IndexEntries);
|
||||
|
||||
return Error();
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
static int error(const Twine &Error, const Twine &Context) {
|
||||
|
@ -1113,7 +1113,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) {
|
||||
}
|
||||
|
||||
{
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : A->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary(&Context);
|
||||
if (!ChildOrErr) {
|
||||
@ -1178,7 +1178,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) {
|
||||
} else if (Expected<std::unique_ptr<Archive>> AOrErr =
|
||||
I->getAsArchive()) {
|
||||
std::unique_ptr<Archive> &A = *AOrErr;
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : A->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr =
|
||||
C.getAsBinary(&Context);
|
||||
@ -1249,7 +1249,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) {
|
||||
} else if (Expected<std::unique_ptr<Archive>> AOrErr =
|
||||
I->getAsArchive()) {
|
||||
std::unique_ptr<Archive> &A = *AOrErr;
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : A->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr =
|
||||
C.getAsBinary(&Context);
|
||||
@ -1316,7 +1316,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) {
|
||||
} else if (Expected<std::unique_ptr<Archive>> AOrErr =
|
||||
I->getAsArchive()) {
|
||||
std::unique_ptr<Archive> &A = *AOrErr;
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : A->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr =
|
||||
C.getAsBinary(&Context);
|
||||
|
@ -1546,7 +1546,8 @@ static void printArchiveChild(StringRef Filename, const Archive::Child &C,
|
||||
static void printArchiveHeaders(StringRef Filename, Archive *A, bool verbose,
|
||||
bool print_offset,
|
||||
StringRef ArchitectureName = StringRef()) {
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
;
|
||||
for (const auto &C : A->children(Err, false))
|
||||
printArchiveChild(Filename, C, verbose, print_offset, ArchitectureName);
|
||||
|
||||
@ -1583,7 +1584,7 @@ void llvm::ParseInputMachO(StringRef Filename) {
|
||||
if (ArchiveHeaders)
|
||||
printArchiveHeaders(Filename, A, !NonVerbose, ArchiveMemberOffsets);
|
||||
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : A->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
|
||||
if (!ChildOrErr) {
|
||||
@ -1641,7 +1642,7 @@ void llvm::ParseInputMachO(StringRef Filename) {
|
||||
if (ArchiveHeaders)
|
||||
printArchiveHeaders(Filename, A.get(), !NonVerbose,
|
||||
ArchiveMemberOffsets, ArchitectureName);
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : A->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
|
||||
if (!ChildOrErr) {
|
||||
@ -1697,7 +1698,7 @@ void llvm::ParseInputMachO(StringRef Filename) {
|
||||
if (ArchiveHeaders)
|
||||
printArchiveHeaders(Filename, A.get(), !NonVerbose,
|
||||
ArchiveMemberOffsets);
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : A->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
|
||||
if (!ChildOrErr) {
|
||||
@ -1749,7 +1750,7 @@ void llvm::ParseInputMachO(StringRef Filename) {
|
||||
if (ArchiveHeaders)
|
||||
printArchiveHeaders(Filename, A.get(), !NonVerbose,
|
||||
ArchiveMemberOffsets, ArchitectureName);
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : A->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
|
||||
if (!ChildOrErr) {
|
||||
|
@ -1969,7 +1969,7 @@ static void DumpObject(const COFFImportFile *I, const Archive *A) {
|
||||
|
||||
/// @brief Dump each object file in \a a;
|
||||
static void DumpArchive(const Archive *a) {
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : a->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
|
||||
if (!ChildOrErr) {
|
||||
|
@ -458,7 +458,7 @@ static void dumpObject(const ObjectFile *Obj) {
|
||||
|
||||
/// @brief Dumps each object file in \a Arc;
|
||||
static void dumpArchive(const Archive *Arc) {
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &Child : Arc->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr = Child.getAsBinary();
|
||||
if (!ChildOrErr) {
|
||||
|
@ -542,7 +542,7 @@ static void printFileSectionSizes(StringRef file) {
|
||||
|
||||
if (Archive *a = dyn_cast<Archive>(&Bin)) {
|
||||
// This is an archive. Iterate over each member and display its sizes.
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : a->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
|
||||
if (!ChildOrErr) {
|
||||
@ -611,7 +611,7 @@ static void printFileSectionSizes(StringRef file) {
|
||||
std::unique_ptr<Archive> &UA = *AOrErr;
|
||||
// This is an archive. Iterate over each member and display its
|
||||
// sizes.
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : UA->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
|
||||
if (!ChildOrErr) {
|
||||
@ -700,7 +700,7 @@ static void printFileSectionSizes(StringRef file) {
|
||||
std::unique_ptr<Archive> &UA = *AOrErr;
|
||||
// This is an archive. Iterate over each member and display its
|
||||
// sizes.
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : UA->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
|
||||
if (!ChildOrErr) {
|
||||
@ -775,7 +775,7 @@ static void printFileSectionSizes(StringRef file) {
|
||||
I->getAsArchive()) {
|
||||
std::unique_ptr<Archive> &UA = *AOrErr;
|
||||
// This is an archive. Iterate over each member and display its sizes.
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : UA->children(Err)) {
|
||||
Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
|
||||
if (!ChildOrErr) {
|
||||
|
@ -223,8 +223,8 @@ void InstrumentationMapExtractor::exportAsYAML(raw_ostream &OS) {
|
||||
Out << YAMLSleds;
|
||||
}
|
||||
|
||||
static CommandRegistration Unused(&Extract, [] {
|
||||
Error Err;
|
||||
static CommandRegistration Unused(&Extract, []() -> Error {
|
||||
Error Err = Error::success();
|
||||
xray::InstrumentationMapExtractor Extractor(
|
||||
ExtractInput, InstrumentationMapExtractor::InputFormats::ELF, Err);
|
||||
if (Err)
|
||||
|
@ -821,7 +821,7 @@ static void getObjectCoveragePoints(const object::ObjectFile &O,
|
||||
static void
|
||||
visitObjectFiles(const object::Archive &A,
|
||||
function_ref<void(const object::ObjectFile &)> Fn) {
|
||||
Error Err;
|
||||
Error Err = Error::success();
|
||||
for (auto &C : A.children(Err)) {
|
||||
Expected<std::unique_ptr<object::Binary>> ChildOrErr = C.getAsBinary();
|
||||
failIfError(ChildOrErr);
|
||||
|
@ -82,12 +82,14 @@ protected:
|
||||
|
||||
char CustomSubError::ID = 0;
|
||||
|
||||
static Error handleCustomError(const CustomError &CE) { return Error(); }
|
||||
static Error handleCustomError(const CustomError &CE) {
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
static void handleCustomErrorVoid(const CustomError &CE) {}
|
||||
|
||||
static Error handleCustomErrorUP(std::unique_ptr<CustomError> CE) {
|
||||
return Error();
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
static void handleCustomErrorUPVoid(std::unique_ptr<CustomError> CE) {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user