[mlir][PDLL] Allow (and ignore) `-D` tablegen macros. (#124166)
[llvm-project.git] / lldb / test / API / lang / cpp / function-local-class / TestCppFunctionLocalClass.py
blobab81411a9f230c3615133403eba8f8b592f7c94b
1 import lldb
2 from lldbsuite.test.decorators import *
3 from lldbsuite.test.lldbtest import *
4 from lldbsuite.test import lldbutil
7 class TestCase(TestBase):
8 @no_debug_info_test
9 def test(self):
10 self.build()
11 lldbutil.run_to_source_breakpoint(
12 self, "// break here", lldb.SBFileSpec("main.cpp")
15 m_val = self.expect_expr(
16 "m",
17 result_type="WithMember",
18 result_children=[ValueCheck(name="i", value="1")],
20 # FIXME: The non-display name doesn't include the function, so users
21 # can't actually match specific classes by their name. Either document
22 # or fix this.
23 self.assertEqual(m_val.GetType().GetName(), "WithMember")
24 # Try accessing the type in the expression evaluator.
25 self.expect_expr("m.i", result_type="int", result_value="1")
27 self.expect_expr(
28 "typedef_unnamed",
29 result_type="TypedefUnnamed",
30 result_children=[ValueCheck(name="a", value="2")],
32 self.expect_expr(
33 "typedef_unnamed2",
34 result_type="TypedefUnnamed2",
35 result_children=[ValueCheck(name="b", value="3")],
37 self.expect_expr(
38 "unnamed",
39 result_type="(unnamed struct)",
40 result_children=[ValueCheck(name="i", value="4")],
42 self.expect_expr(
43 "unnamed2",
44 result_type="(unnamed struct)",
45 result_children=[ValueCheck(name="j", value="5")],
48 # Try a class that is only forward declared.
49 self.expect_expr("fwd", result_type="Forward *")
50 self.expect(
51 "expression -- fwd->i",
52 error=True,
53 substrs=["member access into incomplete type 'Forward'"],
55 self.expect(
56 "expression -- *fwd",
57 error=True,
58 substrs=["incomplete type 'Forward' where a complete type is required"],
61 # Try a class that has a name that matches a class in the global scope.
62 self.expect_expr("fwd_conflict", result_type="ForwardConflict *")
63 # FIXME: This pulls in the unrelated type with the same name from the
64 # global scope.
65 self.expect(
66 "expression -- fwd_conflict->i",
67 error=True,
68 substrs=[
69 # This should point out that ForwardConflict is incomplete.
70 "no member named 'i' in 'ForwardConflict'"
73 self.expect(
74 "expression -- *fwd_conflict",
75 error=True,
76 substrs=[
77 # This should fail to parse instead.
78 "couldn't read its memory"