[llvm] r198799 - Use getError and remove the error_code operator.
Rafael Espindola
rafael.espindola at gmail.com
Wed Jan 8 14:03:40 PST 2014
Author: rafael
Date: Wed Jan 8 16:03:39 2014
New Revision: 198799
URL: http://llvm.org/viewvc/llvm-project?rev=198799&view=rev
Log:
Use getError and remove the error_code operator.
Modified:
llvm/trunk/include/llvm/Object/ELFObjectFile.h
llvm/trunk/include/llvm/Support/ErrorOr.h
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
llvm/trunk/unittests/Support/ErrorOrTest.cpp
Modified: llvm/trunk/include/llvm/Object/ELFObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=198799&r1=198798&r2=198799&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELFObjectFile.h (original)
+++ llvm/trunk/include/llvm/Object/ELFObjectFile.h Wed Jan 8 16:03:39 2014
@@ -219,7 +219,7 @@ error_code ELFObjectFile<ELFT>::getSymbo
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>::getSymbo
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>::getSecti
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>::getReloc
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) {
Modified: llvm/trunk/include/llvm/Support/ErrorOr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ErrorOr.h?rev=198799&r1=198798&r2=198799&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ErrorOr.h (original)
+++ llvm/trunk/include/llvm/Support/ErrorOr.h Wed Jan 8 16:03:39 2014
@@ -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());
}
}
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=198799&r1=198798&r2=198799&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Wed Jan 8 16:03:39 2014
@@ -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(typena
FullSymbolName += (IsDefault ? "@@" : "@");
FullSymbolName += *Version;
} else
- error(Version);
+ error(Version.getError());
}
DictScope D(W, "Symbol");
Modified: llvm/trunk/unittests/Support/ErrorOrTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ErrorOrTest.cpp?rev=198799&r1=198798&r2=198799&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/ErrorOrTest.cpp (original)
+++ llvm/trunk/unittests/Support/ErrorOrTest.cpp Wed Jan 8 16:03:39 2014
@@ -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
More information about the llvm-commits
mailing list