diff options
| author | Sean Callanan <scallanan@apple.com> | 2016-04-28 01:36:21 +0000 |
|---|---|---|
| committer | Sean Callanan <scallanan@apple.com> | 2016-04-28 01:36:21 +0000 |
| commit | 8bdcd522510f923185cdfaec66c4a78d0a0d38c0 (patch) | |
| tree | d74ced8eb42f135ffea1bbd7f686ea11133a01e5 /lldb/source/Core | |
| parent | a9ad1552ab92a8a8725f628827766008e034d1c0 (diff) | |
| download | bcm5719-llvm-8bdcd522510f923185cdfaec66c4a78d0a0d38c0.tar.gz bcm5719-llvm-8bdcd522510f923185cdfaec66c4a78d0a0d38c0.zip | |
Fixed a bug where const this would cause parser errors about $__lldb_expr.
In templated const functions, trying to run an expression would produce the
error
error: out-of-line definition of '$__lldb_expr' does not match any declaration in 'foo'
member declaration does not match because it is const qualified
error: 1 error parsing expression
which is no good. It turned out we don't actually need to worry about "const,"
we just need to be consistent about the declaration of the expression and the
FunctionDecl we inject into the class for "this."
Also added a test case.
<rdar://problem/24985958>
llvm-svn: 267833
Diffstat (limited to 'lldb/source/Core')
| -rw-r--r-- | lldb/source/Core/Scalar.cpp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/lldb/source/Core/Scalar.cpp b/lldb/source/Core/Scalar.cpp index a45424d0b1f..04970a69b84 100644 --- a/lldb/source/Core/Scalar.cpp +++ b/lldb/source/Core/Scalar.cpp @@ -78,6 +78,74 @@ PromoteToMaxType return Scalar::e_void; } +llvm::APInt +Scalar::APIntWithTypeAndValue(Scalar::Type type, uint64_t raw_value) +{ + // APInt(unsigned numBits, uint64_t val, bool isSigned = false) + unsigned num_bits = 1; + bool is_signed = false; + + switch (type) + { + case Scalar::e_void: + break; + case Scalar::e_sint: + is_signed = true; + num_bits = sizeof(sint_t) * 8; + break; + case Scalar::e_uint: + is_signed = false; + num_bits = sizeof(uint_t) * 8; + break; + case Scalar::e_slong: + is_signed = true; + num_bits = sizeof(slong_t) * 8; + break; + case Scalar::e_ulong: + is_signed = false; + num_bits = sizeof(ulong_t) * 8; + break; + case Scalar::e_slonglong: + is_signed = true; + num_bits = sizeof(slonglong_t) * 8; + break; + case Scalar::e_ulonglong: + is_signed = false; + num_bits = sizeof(ulonglong_t) * 8; + break; + case Scalar::e_sint128: + is_signed = true; + num_bits = 128; + break; + case Scalar::e_uint128: + is_signed = false; + num_bits = 128; + break; + case Scalar::e_sint256: + is_signed = true; + num_bits = 256; + break; + case Scalar::e_uint256: + is_signed = false; + num_bits = 256; + break; + case Scalar::e_float: + is_signed = false; + num_bits = sizeof(float_t) * 8; + break; + case Scalar::e_double: + is_signed = false; + num_bits = sizeof(double_t) * 8; + break; + case Scalar::e_long_double: + is_signed = false; + num_bits = sizeof(long_double_t) * 8; + break; + } + + return llvm::APInt(num_bits, raw_value, is_signed); +} + Scalar::Scalar() : m_type(e_void), m_float((float)0) |

