================ @@ -1089,6 +1089,116 @@ int64_t ValueObject::GetValueAsSigned(int64_t fail_value, bool *success) { return fail_value; } +llvm::APSInt ValueObject::GetValueAsAPSInt() { + lldb::TargetSP target = GetTargetSP(); + uint64_t byte_size = 0; + if (auto temp = GetCompilerType().GetByteSize(target.get())) + byte_size = temp.value(); + + unsigned bit_width = static_cast<unsigned>(byte_size * CHAR_BIT); + bool success = true; + uint64_t fail_value = 0; + uint64_t ret_val = GetValueAsUnsigned(fail_value, &success); + uint64_t new_value = fail_value; + if (success) + new_value = ret_val; + bool is_signed = GetCompilerType().IsSigned(); ---------------- clayborg wrote:
Extract the `APInt` from the contained `Scalar` value directly. No need to create a location uint64_t and then try to re-create, the `Scalar` ivar already contains an `APInt`. So just do: ``` if (CanProvideValue()) { Scalar scalar; if (ResolveValue(scalar)) { if (success) *success = true; scalar.MakeUnsigned(); return scalar.m_integer; // Might need to provide an accessor for Scalar::m_integer } } ``` https://github.com/llvm/llvm-project/pull/87197 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits