[Lldb-commits] [lldb] 5daa39a - [lldb/Utility] Merge Scalar::Get(Value)TypeAsCString
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Mon Jul 6 01:34:41 PDT 2020
Author: Pavel Labath
Date: 2020-07-06T10:34:12+02:00
New Revision: 5daa39aa4c355e899c2ceb371ba3c8347200a687
URL: https://github.com/llvm/llvm-project/commit/5daa39aa4c355e899c2ceb371ba3c8347200a687
DIFF: https://github.com/llvm/llvm-project/commit/5daa39aa4c355e899c2ceb371ba3c8347200a687.diff
LOG: [lldb/Utility] Merge Scalar::Get(Value)TypeAsCString
Added:
Modified:
lldb/include/lldb/Utility/Scalar.h
lldb/source/Utility/Scalar.cpp
lldb/unittests/Utility/ScalarTest.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Utility/Scalar.h b/lldb/include/lldb/Utility/Scalar.h
index 275df4d63b0d..f215fa71c84c 100644
--- a/lldb/include/lldb/Utility/Scalar.h
+++ b/lldb/include/lldb/Utility/Scalar.h
@@ -125,7 +125,7 @@ class Scalar {
m_integer.clearAllBits();
}
- const char *GetTypeAsCString() const;
+ const char *GetTypeAsCString() const { return GetValueTypeAsCString(m_type); }
void GetValue(Stream *s, bool show_type) const;
diff --git a/lldb/source/Utility/Scalar.cpp b/lldb/source/Utility/Scalar.cpp
index c36ccab21a39..7397744fb51c 100644
--- a/lldb/source/Utility/Scalar.cpp
+++ b/lldb/source/Utility/Scalar.cpp
@@ -229,44 +229,6 @@ void Scalar::GetValue(Stream *s, bool show_type) const {
}
}
-const char *Scalar::GetTypeAsCString() const {
- switch (m_type) {
- case e_void:
- return "void";
- case e_sint:
- return "int";
- case e_uint:
- return "unsigned int";
- case e_slong:
- return "long";
- case e_ulong:
- return "unsigned long";
- case e_slonglong:
- return "long long";
- case e_ulonglong:
- return "unsigned long long";
- case e_sint128:
- return "int128_t";
- case e_uint128:
- return "unsigned int128_t";
- case e_sint256:
- return "int256_t";
- case e_uint256:
- return "unsigned int256_t";
- case e_sint512:
- return "int512_t";
- case e_uint512:
- return "unsigned int512_t";
- case e_float:
- return "float";
- case e_double:
- return "double";
- case e_long_double:
- return "long double";
- }
- return "<invalid Scalar type>";
-}
-
Scalar::~Scalar() = default;
Scalar::Type Scalar::GetBestTypeForBitSize(size_t bit_size, bool sign) {
diff --git a/lldb/unittests/Utility/ScalarTest.cpp b/lldb/unittests/Utility/ScalarTest.cpp
index afbb76103ca6..910ff173bc92 100644
--- a/lldb/unittests/Utility/ScalarTest.cpp
+++ b/lldb/unittests/Utility/ScalarTest.cpp
@@ -362,7 +362,7 @@ TEST(ScalarTest, Scalar_512) {
ASSERT_TRUE(S.MakeUnsigned());
EXPECT_EQ(S.GetType(), Scalar::e_uint512);
- ASSERT_STREQ(S.GetTypeAsCString(), "unsigned int512_t");
+ ASSERT_STREQ(S.GetTypeAsCString(), "uint512_t");
ASSERT_STREQ(S.GetValueTypeAsCString(Scalar::e_uint512), "uint512_t");
EXPECT_EQ(S.GetByteSize(), 64U);
More information about the lldb-commits
mailing list