[flang] Fix length handling in character kind implicit conversion (#74586)
[llvm-project.git] / lldb / test / Shell / SymbolFile / PDB / Inputs / ClassLayoutTest.cpp
blob34a0895ea787c07893028d5d8519b5db3716fb98
1 // To avoid linking MSVC specific libs, we don't test virtual/override methods
2 // that needs vftable support in this file.
4 // Enum.
5 enum Enum { RED, GREEN, BLUE };
6 Enum EnumVar;
8 // Union.
9 union Union {
10 short Row;
11 unsigned short Col;
12 int Line : 16; // Test named bitfield.
13 short : 8; // Unnamed bitfield symbol won't be generated in PDB.
14 long Table;
16 Union UnionVar;
18 // Struct.
19 struct Struct;
20 typedef Struct StructTypedef;
22 struct Struct {
23 bool A;
24 unsigned char UCharVar;
25 unsigned int UIntVar;
26 long long LongLongVar;
27 Enum EnumVar; // Test struct has UDT member.
28 int array[10];
30 struct Struct StructVar;
32 struct _List; // Forward declaration.
33 struct Complex {
34 struct _List *array[90];
35 struct { // Test unnamed struct. MSVC treats it as `int x`
36 int x;
38 union { // Test unnamed union. MSVC treats it as `int a; float b;`
39 int a;
40 float b;
43 struct Complex c;
45 struct _List { // Test doubly linked list.
46 struct _List *current;
47 struct _List *previous;
48 struct _List *next;
50 struct _List ListVar;
52 typedef struct {
53 int a;
54 } UnnamedStruct; // Test unnamed typedef-ed struct.
55 UnnamedStruct UnnanmedVar;
57 // Class.
58 namespace MemberTest {
59 class Base {
60 public:
61 Base() {}
62 ~Base() {}
64 public:
65 int Get() { return 0; }
67 protected:
68 int a;
70 class Friend {
71 public:
72 int f() { return 3; }
74 class Class : public Base { // Test base class.
75 friend Friend;
76 static int m_static; // Test static member variable.
77 public:
78 Class() : m_public(), m_private(), m_protected() {}
79 explicit Class(int a) { m_public = a; } // Test first reference of m_public.
80 ~Class() {}
82 static int StaticMemberFunc(int a, ...) {
83 return 1;
84 } // Test static member function.
85 int Get() { return 1; }
86 int f(Friend c) { return c.f(); }
87 inline bool operator==(const Class &rhs) const // Test operator.
89 return (m_public == rhs.m_public);
92 public:
93 int m_public;
94 struct Struct m_struct;
96 private:
97 Union m_union;
98 int m_private;
100 protected:
101 friend class Friend;
102 int m_protected;
104 } // namespace MemberTest
106 int main() {
107 MemberTest::Base B1;
108 B1.Get();
109 // Create instance of C1 so that it has debug info (due to constructor
110 // homing).
111 MemberTest::Class C1;
112 MemberTest::Class::StaticMemberFunc(1, 10, 2);
113 return 0;