xref: /llvm-project/lldb/test/API/lang/cpp/nested-class-other-compilation-unit/main.cpp (revision 99451b4453688a94c6014cac233d371ab4cc342d)
1*99451b44SJordan Rupprecht #include "shared.h"
2*99451b44SJordan Rupprecht 
3*99451b44SJordan Rupprecht struct WrapperA {
4*99451b44SJordan Rupprecht   OuterY::Inner<unsigned int> y;
5*99451b44SJordan Rupprecht };
6*99451b44SJordan Rupprecht 
main()7*99451b44SJordan Rupprecht int main() {
8*99451b44SJordan Rupprecht   // WrapperA refers to the Inner and Outer class DIEs from this CU.
9*99451b44SJordan Rupprecht   WrapperA a;
10*99451b44SJordan Rupprecht   // WrapperB refers to the Inner and Outer DIEs from the other.cpp CU.
11*99451b44SJordan Rupprecht   // It is important that WrapperB is only forward-declared in shared.h.
12*99451b44SJordan Rupprecht   WrapperB* b = foo();
13*99451b44SJordan Rupprecht 
14*99451b44SJordan Rupprecht   // Evaluating 'b' here will parse other.cpp's DIEs for all
15*99451b44SJordan Rupprecht   // the Inner and Outer classes from shared.h.
16*99451b44SJordan Rupprecht   //
17*99451b44SJordan Rupprecht   // Evaluating 'a' here will find and reuse the already-parsed
18*99451b44SJordan Rupprecht   // versions of the Inner and Outer classes. In the associated test
19*99451b44SJordan Rupprecht   // we make sure that we can still resolve all the types properly
20*99451b44SJordan Rupprecht   // by evaluating 'a.y.oY_inner.oX_inner'.
21*99451b44SJordan Rupprecht   return 0;  // break here
22*99451b44SJordan Rupprecht }
23