[DWARF] Expose raw bytes in DWARFExpression
authorRafael Auler <rafaelauler@fb.com>
Thu, 5 Aug 2021 00:15:29 +0000 (17:15 -0700)
committerRafael Auler <rafaelauler@fb.com>
Wed, 18 Aug 2021 21:41:20 +0000 (14:41 -0700)
commitd8bbfe8a489780bf3536e098aa1220035a0f77bb
treeaea275ba3e57a8fb5ef5a9c600e8f93988b69864
parent41e5dbe0fa95933c60bd70eda65af0f2d0243e39
[DWARF] Expose raw bytes in DWARFExpression

This information is necessary for clients of DebugInfo that
do not want to process a DWARF expression, but just treat it as a blob
of data. In BOLT, for example, we need to read these expressions in
CFIs and write them back to the binary, unchanged, so having access to
the original expression encoding is a shortcut to avoid the need to
re-encode the entire expression when re-writing exception handling
info (CFIs).

This patch is an alternative to https://reviews.llvm.org/D98301, in
which we implement the support to re-encode these expressions. But
since we don't really need to change anything in these expressions,
we can just copy their bytes.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D107515
llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
llvm/unittests/DebugInfo/DWARF/CMakeLists.txt
llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp [new file with mode: 0644]