Recommit r368812 "[llvm/Object] - Convert SectionRef::getName() to return Expected<>"
commitc1f7dd4f270e0f4558843aa066f6d5b28f93b3af
authorGeorge Rimar <grimar@accesssoftek.com>
Wed, 14 Aug 2019 11:10:11 +0000 (14 11:10 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Wed, 14 Aug 2019 11:10:11 +0000 (14 11:10 +0000)
treec20fd2825e3a35fa9b868c15580617bc671fbd91
parent3527549e303891544adcc6cf0f656878b79d2359
Recommit r368812 "[llvm/Object] - Convert SectionRef::getName() to return Expected<>"

Changes: no changes. A fix for the clang code will be landed right on top.

Original commit message:

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368826 91177308-0d34-0410-b5e6-96231b3b80d8
40 files changed:
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