mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Use getError and remove the error_code operator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198799 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6b71233fb1
commit
dee18bb2e8
@ -219,7 +219,7 @@ error_code ELFObjectFile<ELFT>::getSymbolName(DataRefImpl Symb,
|
||||
StringRef &Result) const {
|
||||
ErrorOr<StringRef> Name = EF.getSymbolName(toELFSymIter(Symb));
|
||||
if (!Name)
|
||||
return Name;
|
||||
return Name.getError();
|
||||
Result = *Name;
|
||||
return object_error::success;
|
||||
}
|
||||
@ -233,7 +233,7 @@ error_code ELFObjectFile<ELFT>::getSymbolVersion(SymbolRef SymRef,
|
||||
ErrorOr<StringRef> Ver =
|
||||
EF.getSymbolVersion(EF.getSection(Symb.d.b), symb, IsDefault);
|
||||
if (!Ver)
|
||||
return Ver;
|
||||
return Ver.getError();
|
||||
Version = *Ver;
|
||||
return object_error::success;
|
||||
}
|
||||
@ -435,7 +435,7 @@ error_code ELFObjectFile<ELFT>::getSectionName(DataRefImpl Sec,
|
||||
StringRef &Result) const {
|
||||
ErrorOr<StringRef> Name = EF.getSectionName(&*toELFShdrIter(Sec));
|
||||
if (!Name)
|
||||
return Name;
|
||||
return Name.getError();
|
||||
Result = *Name;
|
||||
return object_error::success;
|
||||
}
|
||||
@ -743,7 +743,7 @@ error_code ELFObjectFile<ELFT>::getRelocationValueString(
|
||||
ErrorOr<StringRef> SymName =
|
||||
EF.getSymbolName(EF.getSection(sec->sh_link), symb);
|
||||
if (!SymName)
|
||||
return SymName;
|
||||
return SymName.getError();
|
||||
switch (EF.getHeader()->e_machine) {
|
||||
case ELF::EM_X86_64:
|
||||
switch (type) {
|
||||
|
@ -181,10 +181,6 @@ public:
|
||||
T &get() { return *getStorage(); }
|
||||
const T &get() const { return const_cast<ErrorOr<T> >(this)->get(); }
|
||||
|
||||
operator llvm::error_code() const {
|
||||
return HasError ? *getErrorStorage() : llvm::error_code::success();
|
||||
}
|
||||
|
||||
error_code getError() const {
|
||||
return HasError ? *getErrorStorage() : error_code::success();
|
||||
}
|
||||
@ -240,7 +236,7 @@ private:
|
||||
} else {
|
||||
// Get other's error.
|
||||
HasError = true;
|
||||
new (getErrorStorage()) error_code(Other);
|
||||
new (getErrorStorage()) error_code(Other.getError());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ private:
|
||||
|
||||
template <class T> T errorOrDefault(ErrorOr<T> Val, T Default = T()) {
|
||||
if (!Val) {
|
||||
error(Val);
|
||||
error(Val.getError());
|
||||
return Default;
|
||||
}
|
||||
|
||||
@ -632,7 +632,7 @@ void ELFDumper<ELFT>::printSymbol(typename ELFO::Elf_Sym_Iter Symbol) {
|
||||
FullSymbolName += (IsDefault ? "@@" : "@");
|
||||
FullSymbolName += *Version;
|
||||
} else
|
||||
error(Version);
|
||||
error(Version.getError());
|
||||
}
|
||||
|
||||
DictScope D(W, "Symbol");
|
||||
|
@ -25,7 +25,7 @@ TEST(ErrorOr, SimpleValue) {
|
||||
|
||||
a = t2();
|
||||
EXPECT_FALSE(a);
|
||||
EXPECT_EQ(errc::invalid_argument, a);
|
||||
EXPECT_EQ(errc::invalid_argument, a.getError());
|
||||
#ifdef EXPECT_DEBUG_DEATH
|
||||
EXPECT_DEBUG_DEATH(*a, "Cannot get value when an error exists");
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user