[DebugInfo][NFCI] Refactor DWARFAbbreviationDeclaration::extract
authorAlex Langford <alangford@apple.com>
Mon, 15 May 2023 20:21:15 +0000 (13:21 -0700)
committerAlex Langford <alangford@apple.com>
Tue, 16 May 2023 19:54:38 +0000 (12:54 -0700)
commit631ff46cbf51dce943f5c136bb6b2b283a8053c0
tree7c8dfdea48fcc1d2610c0c0259870e3420a0bd6a
parentc5c6ea8e12b623880597963ce7274223b47ac5d2
[DebugInfo][NFCI] Refactor DWARFAbbreviationDeclaration::extract

The motivation behind this refactor is to be able to use
DWARFAbbreviationDeclaration from LLDB. LLDB has its own implementation
of DWARFAbbreviationDeclaration that is very similar to LLVM's but it
has different semantics around error handling.

This patch modifies llvm::DWARFAbbreviationDeclaration::extract to
return an `llvm::Expected<ExtractState>` to differentiate between "I am
done extracting" and "An error has occured", something which the current
return type (bool) does not accurately capture.

Differential Revision: https://reviews.llvm.org/D150607
llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp