[llvm/Object] - Convert SectionRef::getName() to return Expected<>
authorGeorge Rimar <grimar@accesssoftek.com>
Wed, 14 Aug 2019 08:46:54 +0000 (08:46 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Wed, 14 Aug 2019 08:46:54 +0000 (08:46 +0000)
commita0c6a3571422826e856002714d9bb008584fe8b3
tree13316b7a2db6ed9d4bc4457853028a77e8eb56fd
parentd4a99d87a20dae0507a95322fc903768f627185a
[llvm/Object] - Convert SectionRef::getName() to return Expected<>

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

For example, it forces user to check the error returned.
Also Expected<> may keep a valuable string error message,
what 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.

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).

Differential revision: https://reviews.llvm.org/D66089

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