Skip to content

Commit fa1b602

Browse files
committed
[lldb][NFC] Modernize TestCallUserAnonTypedef
1 parent 61bab7c commit fa1b602

File tree

2 files changed

+12
-39
lines changed

2 files changed

+12
-39
lines changed

lldb/test/API/commands/expression/anonymous-struct/TestCallUserAnonTypedef.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,21 @@
66
Ticket: https://llvm.org/bugs/show_bug.cgi?id=26790
77
"""
88

9-
109
import lldb
1110

1211
from lldbsuite.test.decorators import *
1312
from lldbsuite.test.lldbtest import *
1413
from lldbsuite.test import lldbutil
1514

16-
1715
class TestExprLookupAnonStructTypedef(TestBase):
1816
mydir = TestBase.compute_mydir(__file__)
1917

20-
def setUp(self):
21-
TestBase.setUp(self)
22-
# Find the breakpoint
23-
self.line = line_number('main.cpp', '// lldb testsuite break')
24-
2518
@expectedFailureAll(
2619
oslist=['linux'],
2720
archs=['arm'],
2821
bugnumber="llvm.org/pr27868")
2922
def test(self):
3023
"""Test typedeffed untagged struct arguments for function call expressions"""
3124
self.build()
32-
33-
self.runCmd("file "+self.getBuildArtifact("a.out"),
34-
CURRENT_EXECUTABLE_SET)
35-
lldbutil.run_break_set_by_file_and_line(
36-
self,
37-
"main.cpp",
38-
self.line,
39-
num_expected_locations=-1,
40-
loc_exact=True
41-
)
42-
43-
self.runCmd("run", RUN_SUCCEEDED)
25+
lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp"))
4426
self.expect_expr("multiply(&s)", result_type="double", result_value="1")
Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
1-
#include <tgmath.h>
2-
31
typedef struct {
4-
float f;
5-
int i;
2+
float f;
3+
int i;
64
} my_untagged_struct;
75

8-
double multiply(my_untagged_struct *s)
9-
{
10-
return s->f * s->i;
11-
}
6+
double multiply(my_untagged_struct *s) { return s->f * s->i; }
127

13-
double multiply(my_untagged_struct *s, int x)
14-
{
15-
return multiply(s) * x;
16-
}
8+
double multiply(my_untagged_struct *s, int x) { return multiply(s) * x; }
179

18-
int main(int argc, char **argv)
19-
{
20-
my_untagged_struct s = {
21-
.f = (float)argc,
22-
.i = argc,
23-
};
24-
// lldb testsuite break
25-
return !(multiply(&s, argc) == pow(argc, 3));
10+
int main(int argc, char **argv) {
11+
my_untagged_struct s = {
12+
.f = (float)argc,
13+
.i = argc,
14+
};
15+
// break here
16+
return multiply(&s, argc) > 0;
2617
}

0 commit comments

Comments
 (0)