[llvm] r368430 - [llvm-readobj] - Remove `error(llvm::Expected<T> &&E)`
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 9 04:03:21 PDT 2019
Author: grimar
Date: Fri Aug 9 04:03:21 2019
New Revision: 368430
URL: http://llvm.org/viewvc/llvm-project?rev=368430&view=rev
Log:
[llvm-readobj] - Remove `error(llvm::Expected<T> &&E)`
This is a bit strange method. It works like a unwrapOrError,
but named error. It does not report an Input name.
I removed it.
Differential revision: https://reviews.llvm.org/D66000
Modified:
llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
llvm/trunk/tools/llvm-readobj/WasmDumper.cpp
llvm/trunk/tools/llvm-readobj/llvm-readobj.h
Modified: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=368430&r1=368429&r2=368430&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp Fri Aug 9 04:03:21 2019
@@ -1048,7 +1048,8 @@ void COFFDumper::printCodeViewSymbolSect
// To find the active frame description, search this array for the
// smallest PC range that includes the current PC.
for (const auto &FD : FrameData) {
- StringRef FrameFunc = error(CVStringTable.getString(FD.FrameFunc));
+ StringRef FrameFunc = unwrapOrError(
+ Obj->getFileName(), CVStringTable.getString(FD.FrameFunc));
DictScope S(W, "FrameData");
W.printHex("RvaStart", FD.RvaStart);
@@ -1169,7 +1170,8 @@ void COFFDumper::printCodeViewFileChecks
for (auto &FC : Checksums) {
DictScope S(W, "FileChecksum");
- StringRef Filename = error(CVStringTable.getString(FC.FileNameOffset));
+ StringRef Filename = unwrapOrError(
+ Obj->getFileName(), CVStringTable.getString(FC.FileNameOffset));
W.printHex("Filename", Filename, FC.FileNameOffset);
W.printHex("ChecksumSize", FC.Checksum.size());
W.printEnum("ChecksumKind", uint8_t(FC.Kind),
@@ -1211,7 +1213,8 @@ StringRef COFFDumper::getFileNameForFile
if (Iter == CVFileChecksumTable.end())
error(object_error::parse_failed);
- return error(CVStringTable.getString(Iter->FileNameOffset));
+ return unwrapOrError(Obj->getFileName(),
+ CVStringTable.getString(Iter->FileNameOffset));
}
void COFFDumper::printFileNameForOffset(StringRef Label, uint32_t FileOffset) {
Modified: llvm/trunk/tools/llvm-readobj/WasmDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/WasmDumper.cpp?rev=368430&r1=368429&r2=368430&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/WasmDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/WasmDumper.cpp Fri Aug 9 04:03:21 2019
@@ -90,7 +90,7 @@ void WasmDumper::printRelocation(const S
StringRef SymName;
symbol_iterator SI = Reloc.getSymbol();
if (SI != Obj->symbol_end())
- SymName = error(SI->getName());
+ SymName = unwrapOrError(Obj->getFileName(), SI->getName());
bool HasAddend = false;
switch (RelocType) {
Modified: llvm/trunk/tools/llvm-readobj/llvm-readobj.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.h?rev=368430&r1=368429&r2=368430&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/llvm-readobj.h (original)
+++ llvm/trunk/tools/llvm-readobj/llvm-readobj.h Fri Aug 9 04:03:21 2019
@@ -28,10 +28,6 @@ namespace llvm {
void warn(llvm::Error Err);
void error(std::error_code EC);
void error(llvm::Error EC);
- template <typename T> T error(llvm::Expected<T> &&E) {
- error(E.takeError());
- return std::move(*E);
- }
template <class T> T unwrapOrError(StringRef Input, Expected<T> EO) {
if (EO)
More information about the llvm-commits
mailing list