Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / types / TestRecursiveTypes.py
blob63f18cf230175736902446d1b026b99f2b463012
1 """
2 Test that recursive types are handled correctly.
3 """
6 import lldb
7 import lldbsuite.test.lldbutil as lldbutil
8 from lldbsuite.test.lldbtest import *
11 class RecursiveTypesTestCase(TestBase):
12 def setUp(self):
13 # Call super's setUp().
14 TestBase.setUp(self)
16 # Find the line number to break for main.c.
17 self.line = line_number("recursive_type_main.cpp", "// Test at this line.")
19 self.d1 = {"CXX_SOURCES": "recursive_type_main.cpp recursive_type_1.cpp"}
20 self.d2 = {"CXX_SOURCES": "recursive_type_main.cpp recursive_type_2.cpp"}
22 def test_recursive_type_1(self):
23 """Test that recursive structs are displayed correctly."""
24 self.build(dictionary=self.d1)
25 self.setTearDownCleanup(dictionary=self.d1)
26 self.print_struct()
28 def test_recursive_type_2(self):
29 """Test that recursive structs are displayed correctly."""
30 self.build(dictionary=self.d2)
31 self.setTearDownCleanup(dictionary=self.d2)
32 self.print_struct()
34 def print_struct(self):
35 self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
37 lldbutil.run_break_set_by_file_and_line(
38 self,
39 "recursive_type_main.cpp",
40 self.line,
41 num_expected_locations=-1,
42 loc_exact=True,
45 self.runCmd("run", RUN_SUCCEEDED)
47 self.runCmd("expression tpi")
48 self.runCmd("expression *tpi")