Page MenuHomePhabricator

D66000.diff
No OneTemporary

File Metadata

Created
Sun, Oct 20, 6:34 AM

D66000.diff

Index: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
===================================================================
--- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
+++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
@@ -1048,7 +1048,8 @@
// 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 @@
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 @@
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) {
Index: llvm/trunk/tools/llvm-readobj/WasmDumper.cpp
===================================================================
--- llvm/trunk/tools/llvm-readobj/WasmDumper.cpp
+++ llvm/trunk/tools/llvm-readobj/WasmDumper.cpp
@@ -90,7 +90,7 @@
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) {
Index: llvm/trunk/tools/llvm-readobj/llvm-readobj.h
===================================================================
--- llvm/trunk/tools/llvm-readobj/llvm-readobj.h
+++ llvm/trunk/tools/llvm-readobj/llvm-readobj.h
@@ -28,10 +28,6 @@
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)

Event Timeline