[lldb/Utility] Remove some Scalar type accessors

Now that the number of Scalar "types" has been reduced, these don't make
sense anymore.
This commit is contained in:
Pavel Labath 2020-08-20 09:20:55 +02:00
parent 2e194fe73b
commit 0e301fd023
2 changed files with 3 additions and 32 deletions

View file

@ -75,11 +75,7 @@ public:
llvm::APFloat::rmNearestTiesToEven, &ignore);
}
Scalar(llvm::APInt v)
: m_type(GetBestTypeForBitSize(v.getBitWidth(), true)),
m_integer(std::move(v)), m_float(0.0f) {}
/// Return the most efficient Scalar::Type for the requested bit size.
static Type GetBestTypeForBitSize(size_t bit_size, bool sign);
: m_type(e_sint), m_integer(std::move(v)), m_float(0.0f) {}
bool SignExtend(uint32_t bit_pos);
@ -126,12 +122,6 @@ public:
static const char *GetValueTypeAsCString(Scalar::Type value_type);
static Scalar::Type
GetValueTypeForSignedIntegerWithByteSize(size_t byte_size);
static Scalar::Type
GetValueTypeForUnsignedIntegerWithByteSize(size_t byte_size);
// All operators can benefits from the implicit conversions that will happen
// automagically by the compiler, so no temporary objects will need to be
// created. As a result, we currently don't need a variety of overloaded set

View file

@ -197,13 +197,9 @@ void Scalar::GetValue(Stream *s, bool show_type) const {
}
}
Scalar::Type Scalar::GetBestTypeForBitSize(size_t bit_size, bool sign) {
return sign ? e_sint : e_uint;
}
void Scalar::TruncOrExtendTo(uint16_t bits, bool sign) {
m_integer = sign ? m_integer.sextOrTrunc(bits) : m_integer.zextOrTrunc(bits);
m_type = GetBestTypeForBitSize(bits, sign);
m_type = sign ? e_sint : e_uint;
}
bool Scalar::IntegralPromote(uint16_t bits, bool sign) {
@ -262,16 +258,6 @@ const char *Scalar::GetValueTypeAsCString(Scalar::Type type) {
return "???";
}
Scalar::Type
Scalar::GetValueTypeForSignedIntegerWithByteSize(size_t byte_size) {
return e_sint;
}
Scalar::Type
Scalar::GetValueTypeForUnsignedIntegerWithByteSize(size_t byte_size) {
return e_uint;
}
bool Scalar::MakeSigned() {
bool success = false;
@ -768,12 +754,7 @@ Status Scalar::SetValueFromData(const DataExtractor &data,
case lldb::eEncodingSint: {
if (data.GetByteSize() < byte_size)
return Status("insufficient data");
Type type = GetBestTypeForBitSize(byte_size*8, encoding == lldb::eEncodingSint);
if (type == e_void) {
return Status("unsupported integer byte size: %" PRIu64 "",
static_cast<uint64_t>(byte_size));
}
m_type = type;
m_type = encoding == lldb::eEncodingSint ? e_sint : e_uint;
if (data.GetByteOrder() == endian::InlHostByteOrder()) {
m_integer = APInt::getNullValue(8 * byte_size);
llvm::LoadIntFromMemory(m_integer, data.GetDataStart(), byte_size);