[PATCH] D66089: [llvm/Object] - Convert SectionRef::getName() to return Expected<>

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 07:11:00 PDT 2019


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: rupprecht, aheejin, sbc100, javed.absar.
Herald added a reviewer: JDevlieghere.

`SectionRef::getName()` returns `std::error_code` now.
Returning `Expected<>` instead has multiple benefirs

For example, it forces user to check the error returned.
Also `Expected<>` may keep a valuable string error message,
that is more useful than having a error code.
(`Object\invalid.test` was updated to show the new messages printed.)

This patch makes a change for all users to switch to `Expected<>` version.

Important note: in a few places the error returned was ignored before my changes.
In such places I left them ignored. My intention was to convert the interface
used, and not to improve and/or the existent users in this patch.
(Though I think this is good idea for a follow-ups to revisit such places
and either remove `consumeError` calls or comment each of them to clarify why
it is OK to have them).


https://reviews.llvm.org/D66089

Files:
  include/llvm/Object/ELFObjectFile.h
  include/llvm/Object/ObjectFile.h
  lib/DebugInfo/DWARF/DWARFContext.cpp
  lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
  lib/DebugInfo/Symbolize/Symbolize.cpp
  lib/ExecutionEngine/JITLink/MachOAtomGraphBuilder.cpp
  lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
  lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
  lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
  lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h
  lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h
  lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOI386.h
  lib/Object/COFFObjectFile.cpp
  lib/Object/Decompressor.cpp
  lib/Object/ELFObjectFile.cpp
  lib/Object/MachOObjectFile.cpp
  lib/Object/Object.cpp
  lib/ProfileData/Coverage/CoverageMappingReader.cpp
  lib/XRay/InstrumentationMap.cpp
  test/Object/invalid.test
  tools/dsymutil/DwarfLinker.cpp
  tools/dsymutil/DwarfStreamer.cpp
  tools/llvm-cfi-verify/lib/FileAnalysis.cpp
  tools/llvm-cov/TestingSupport.cpp
  tools/llvm-dwp/llvm-dwp.cpp
  tools/llvm-nm/llvm-nm.cpp
  tools/llvm-objdump/COFFDump.cpp
  tools/llvm-objdump/MachODump.cpp
  tools/llvm-objdump/llvm-objdump.cpp
  tools/llvm-pdbutil/DumpOutputStyle.cpp
  tools/llvm-pdbutil/InputFile.cpp
  tools/llvm-readobj/COFFDumper.cpp
  tools/llvm-readobj/ELFDumper.cpp
  tools/llvm-readobj/MachODumper.cpp
  tools/llvm-readobj/ObjDumper.cpp
  tools/llvm-readobj/WasmDumper.cpp
  tools/llvm-readobj/Win64EHDumper.cpp
  tools/llvm-rtdyld/llvm-rtdyld.cpp
  tools/llvm-size/llvm-size.cpp
  tools/obj2yaml/coff2yaml.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66089.214632.patch
Type: text/x-patch
Size: 55728 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190812/bd7d5aeb/attachment.bin>


More information about the llvm-commits mailing list