From b9c1b51e45b845debb76d8658edabca70ca56079 Mon Sep 17 00:00:00 2001 From: Kate Stone Date: Tue, 6 Sep 2016 20:57:50 +0000 Subject: *** This commit represents a complete reformatting of the LLDB source code *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751 --- .../test/lang/cpp/template/TestTemplateArgs.py | 126 ++++++++++++++------- 1 file changed, 84 insertions(+), 42 deletions(-) (limited to 'lldb/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py') diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py index e08d3a10786..a23dc38795a 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py @@ -1,7 +1,7 @@ """ Test that C++ template classes that have integer parameters work correctly. -We must reconstruct the types correctly so the template types are correct +We must reconstruct the types correctly so the template types are correct and display correctly, and also make sure the expression parser works and is able the find all needed functions when evaluating expressions """ @@ -10,10 +10,11 @@ from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class TemplateArgsTestCase(TestBase): - + mydir = TestBase.compute_mydir(__file__) - + def prepareProcess(self): self.build() @@ -22,66 +23,107 @@ class TemplateArgsTestCase(TestBase): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) - # Set breakpoints inside and outside methods that take pointers to the containing struct. + # Set breakpoints inside and outside methods that take pointers to the + # containing struct. line = line_number('main.cpp', '// Breakpoint 1') - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=True) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", line, num_expected_locations=1, loc_exact=True) arguments = None - environment = None + environment = None # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple (arguments, environment, self.get_process_working_directory()) + process = target.LaunchSimple( + arguments, environment, self.get_process_working_directory()) self.assertTrue(process, PROCESS_IS_VALID) - + # Get the thread of the process - self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED) - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertTrue( + process.GetState() == lldb.eStateStopped, + PROCESS_STOPPED) + thread = lldbutil.get_stopped_thread( + process, lldb.eStopReasonBreakpoint) # Get frame for current thread return thread.GetSelectedFrame() def test_integer_args(self): frame = self.prepareProcess() - - testpos = frame.FindVariable('testpos') - self.assertTrue(testpos.IsValid(), 'make sure we find a local variabble named "testpos"') + + 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.IsValid(), + 'got a valid expression result from expression "testpos.getArg()"') self.assertTrue(expr_result.GetValue() == "1", "testpos.getArg() == 1") - self.assertTrue(expr_result.GetType().GetName() == "int", 'expr_result.GetType().GetName() == "int"') - - testneg = frame.FindVariable('testneg') - self.assertTrue(testneg.IsValid(), 'make sure we find a local variabble named "testneg"') - self.assertTrue(testneg.GetType().GetName() == 'TestObj<-1>') - + self.assertTrue( + expr_result.GetType().GetName() == "int", + 'expr_result.GetType().GetName() == "int"') + + testneg = frame.FindVariable('testneg') + self.assertTrue( + testneg.IsValid(), + 'make sure we find a local variabble named "testneg"') + self.assertTrue(testneg.GetType().GetName() == 'TestObj<-1>') + expr_result = frame.EvaluateExpression("testneg.getArg()") - 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"') + 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"') - # Gcc does not generate the necessary DWARF attribute for enum template parameters. + # Gcc does not generate the necessary DWARF attribute for enum template + # parameters. @expectedFailureAll(bugnumber="llvm.org/pr28354", compiler="gcc") def test_enum_args(self): frame = self.prepareProcess() - # 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') - + # 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') + 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') - + 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') + 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"') + 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"') -- cgit v1.2.3