1struct Outer {
2 typedef int HookToOuter;
3 // When importing this type, we have to import all of it before adding it
4 // via the FieldDecl to 'Outer'. If we don't do this, then Clang will
5 // while adding 'NestedClassMember' ask for the full type of 'NestedClass'
6 // which then will start pulling in the 'RefToOuter' member. That member
7 // will import the typedef above and add it to 'Outer'. And adding a
8 // Decl to a DeclContext that is currently already in the process of adding
9 // another Decl will cause an inconsistent lookup.
10 struct NestedClass {
11 HookToOuter RefToOuter;
12 int SomeMember;
13 } NestedClassMember;
14};
15
16// We query the members of base classes of a type by doing a lookup via Clang.
17// As this tests is trying to find a borked lookup, we need a base class here
18// to make our 'GetChildMemberWithName' use the Clang lookup.
19struct In : Outer {};
20
21In test_var;
22
23int main() { return test_var.NestedClassMember.SomeMember; }
24

source code of lldb/test/API/lang/cpp/reference-to-outer-type/main.cpp