summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateIntegerArgs.py
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2016-06-24 23:48:00 +0000
committerGreg Clayton <gclayton@apple.com>2016-06-24 23:48:00 +0000
commitd7f71add86c892ced324fc26cb0945911f3e26a5 (patch)
tree9ed27eb7686df44798786a1e5b80a0d9ec5c2e7f /lldb/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateIntegerArgs.py
parent4d32eb6939d77f8059683c008bb807167110e930 (diff)
downloadbcm5719-llvm-d7f71add86c892ced324fc26cb0945911f3e26a5.tar.gz
bcm5719-llvm-d7f71add86c892ced324fc26cb0945911f3e26a5.zip
Made templates that have Enumeration values as arguments work correctly.
We were checking for integer types only before this. So I added the ability for CompilerType objects to check for integer and enum types. Then I searched for places that were using the CompilerType::IsIntegerType(...) function. Many of these places also wanted to be checking for enumeration types as well, so I have fixed those places. These are in the ABI plug-ins where we are figuring out which arguments would go in where in regisers/stack when making a function call, or determining where the return value would live. The real fix for this is to use clang to compiler a CGFunctionInfo and then modify the code to be able to take the IR and a calling convention and have the backend answer the questions correctly for us so we don't need to create a really bad copy of the ABI in each plug-in, but that is beyond the scope of this bug fix. Also added a test case to ensure this doesn't regress in the future. llvm-svn: 273750
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateIntegerArgs.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateIntegerArgs.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateIntegerArgs.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateIntegerArgs.py
index 15b18e34f71..0e4c6664930 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateIntegerArgs.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateIntegerArgs.py
@@ -47,6 +47,7 @@ class TemplateIntegerArgsTestCase(TestBase):
testpos = frame.FindVariable('testpos')
self.assertTrue(testpos.IsValid(), 'make sure we find a local variabble named "testpos"')
self.assertTrue(testpos.GetType().GetName() == 'TestObj<1>')
+
expr_result = frame.EvaluateExpression("testpos.getArg()")
self.assertTrue(expr_result.IsValid(), 'got a valid expression result from expression "testpos.getArg()"');
self.assertTrue(expr_result.GetValue() == "1", "testpos.getArg() == 1")
@@ -60,3 +61,23 @@ class TemplateIntegerArgsTestCase(TestBase):
self.assertTrue(expr_result.IsValid(), 'got a valid expression result from expression "testneg.getArg()"');
self.assertTrue(expr_result.GetValue() == "-1", "testneg.getArg() == -1")
self.assertTrue(expr_result.GetType().GetName() == "int", 'expr_result.GetType().GetName() == "int"')
+
+ # Make sure "member" can be displayed and also used in an expression correctly
+ member = frame.FindVariable('member')
+ self.assertTrue(member.IsValid(), 'make sure we find a local variabble named "member"')
+ self.assertTrue(member.GetType().GetName() == 'EnumTemplate<EnumType::Member>')
+
+ expr_result = frame.EvaluateExpression("member.getMember()")
+ self.assertTrue(expr_result.IsValid(), 'got a valid expression result from expression "member.getMember()"');
+ self.assertTrue(expr_result.GetValue() == "123", "member.getMember() == 123")
+ self.assertTrue(expr_result.GetType().GetName() == "int", 'expr_result.GetType().GetName() == "int"')
+
+ # Make sure "subclass" can be displayed and also used in an expression correctly
+ subclass = frame.FindVariable('subclass')
+ self.assertTrue(subclass.IsValid(), 'make sure we find a local variabble named "subclass"')
+ self.assertTrue(subclass.GetType().GetName() == 'EnumTemplate<EnumType::Subclass>')
+
+ expr_result = frame.EvaluateExpression("subclass.getMember()")
+ self.assertTrue(expr_result.IsValid(), 'got a valid expression result from expression "subclass.getMember()"');
+ self.assertTrue(expr_result.GetValue() == "246", "subclass.getMember() == 246")
+ self.assertTrue(expr_result.GetType().GetName() == "int", 'expr_result.GetType().GetName() == "int"')
OpenPOWER on IntegriCloud