diff options
author | Pavel Labath <labath@google.com> | 2018-06-20 10:45:29 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-06-20 10:45:29 +0000 |
commit | c7c9d76187281a9bb78518e40b2b587877a1a2b3 (patch) | |
tree | 6edc7e146a0e0fca3fa7939343cb4c93d71d7089 /lldb/packages/Python/lldbsuite/test/expression_command/ir-interpreter | |
parent | 2145b13fc92c531d0218963c0dab1fb25722f3de (diff) | |
download | bcm5719-llvm-c7c9d76187281a9bb78518e40b2b587877a1a2b3.tar.gz bcm5719-llvm-c7c9d76187281a9bb78518e40b2b587877a1a2b3.zip |
IRInterpreter: fix sign extension of small types (pr37840)
Sign-extension of small types (e.g. short) was not handled correctly.
The reason for that was that when we were assigning the a value to the
Scalar object, we would accidentally promote the type to int (even
though the assignment code in AssignTypeToMatch tried to cast the value
to the appropriate type, it would still invoke the "int" version of
operator=). Instead, I use the APInt version of operator=, where the
bitwidth is specified explicitly. Among other things, this allows us to
fold the individual size cases into one.
llvm-svn: 335114
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/expression_command/ir-interpreter')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/expression_command/ir-interpreter/TestIRInterpreter.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/ir-interpreter/TestIRInterpreter.py b/lldb/packages/Python/lldbsuite/test/expression_command/ir-interpreter/TestIRInterpreter.py index c0f50109ddb..d8a8038c845 100644 --- a/lldb/packages/Python/lldbsuite/test/expression_command/ir-interpreter/TestIRInterpreter.py +++ b/lldb/packages/Python/lldbsuite/test/expression_command/ir-interpreter/TestIRInterpreter.py @@ -17,6 +17,7 @@ from lldbsuite.test import lldbutil class IRInterpreterTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) + NO_DEBUG_INFO_TESTCASE = True def setUp(self): # Call super's setUp(). @@ -85,3 +86,10 @@ class IRInterpreterTestCase(TestBase): jit_result, "While evaluating " + expression) + + def test_type_conversions(self): + target = self.dbg.GetDummyTarget() + short_val = target.EvaluateExpression("(short)-1") + self.assertEqual(short_val.GetValueAsSigned(), -1) + long_val = target.EvaluateExpression("(long) "+ short_val.GetName()) + self.assertEqual(long_val.GetValueAsSigned(), -1) |