Recommit r368812 "[llvm/Object] - Convert SectionRef::getName() to return Expected<>"
authorGeorge Rimar <grimar@accesssoftek.com>
Wed, 14 Aug 2019 11:10:11 +0000 (11:10 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Wed, 14 Aug 2019 11:10:11 +0000 (11:10 +0000)
commitbcc00e1afbdc107e05b2977fde26053a52295dd1
tree0ad3e328d73375164f99adb046a919273a128c1c
parenta11d302fa00ba423b09c94491bc868cb991ff379
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

llvm-svn: 368826
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