[Lldb-commits] [lldb] [llvm] [lldb] Return an llvm::Expected from DWARFExpression::Evaluate (NFCI) (PR #94420)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 5 01:43:22 PDT 2024
================
@@ -2244,30 +2108,26 @@ bool DWARFExpression::Evaluate(
const uint64_t piece_bit_offset = opcodes.GetULEB128(&offset);
switch (stack.back().GetValueType()) {
case Value::ValueType::Invalid:
- return false;
+ return llvm::createStringError(
+ "unable to extract bit value from invalid value.");
case Value::ValueType::Scalar: {
if (!stack.back().GetScalar().ExtractBitfield(piece_bit_size,
piece_bit_offset)) {
- if (error_ptr)
- error_ptr->SetErrorStringWithFormat(
- "unable to extract %" PRIu64 " bit value with %" PRIu64
- " bit offset from a %" PRIu64 " bit scalar value.",
- piece_bit_size, piece_bit_offset,
- (uint64_t)(stack.back().GetScalar().GetByteSize() * 8));
- return false;
+ return llvm::createStringError(
+ "unable to extract %" PRIu64 " bit value with %" PRIu64
+ " bit offset from a %" PRIu64 " bit scalar value.",
+ piece_bit_size, piece_bit_offset,
+ (uint64_t)(stack.back().GetScalar().GetByteSize() * 8));
}
} break;
case Value::ValueType::FileAddress:
case Value::ValueType::LoadAddress:
case Value::ValueType::HostAddress:
- if (error_ptr) {
- error_ptr->SetErrorStringWithFormat(
- "unable to extract DW_OP_bit_piece(bit_size = %" PRIu64
- ", bit_offset = %" PRIu64 ") from an address value.",
- piece_bit_size, piece_bit_offset);
- }
- return false;
+ return llvm::createStringError(
----------------
DavidSpickett wrote:
I see you added it later.
https://github.com/llvm/llvm-project/pull/94420
More information about the lldb-commits
mailing list