Zachary Turner | a54b7dd | 2015-02-22 06:47:32 +0000 | [diff] [blame] | 1 | // Compile with "cl /c /Zi /GR- symbolformat.cpp" |
| 2 | // Compile symbolformat-fpo.cpp (see file for instructions) |
| 3 | // Link with "link symbolformat.obj symbolformat-fpo.obj /debug /nodefaultlib |
| 4 | // /entry:main /out:symbolformat.exe" |
| 5 | |
| 6 | int __cdecl _purecall(void) { return 0; } |
| 7 | |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 8 | enum TestEnum { |
| 9 | Value, |
| 10 | Value10 = 10 |
| 11 | }; |
| 12 | |
| 13 | enum class TestEnumClass { |
| 14 | Value, |
| 15 | Value10 = 10 |
| 16 | }; |
| 17 | |
Zachary Turner | a54b7dd | 2015-02-22 06:47:32 +0000 | [diff] [blame] | 18 | struct A { |
| 19 | virtual void PureFunc() = 0 {} |
| 20 | virtual void VirtualFunc() {} |
| 21 | void RegularFunc() {} |
| 22 | }; |
| 23 | |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 24 | struct VirtualBase { |
Zachary Turner | a54b7dd | 2015-02-22 06:47:32 +0000 | [diff] [blame] | 25 | }; |
| 26 | |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 27 | struct B : public A, protected virtual VirtualBase { |
| 28 | void PureFunc() override {} |
Zachary Turner | d270d22 | 2015-02-26 23:49:23 +0000 | [diff] [blame] | 29 | }; |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 30 | |
Zachary Turner | d270d22 | 2015-02-26 23:49:23 +0000 | [diff] [blame] | 31 | struct MemberTest { |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 32 | enum NestedEnum { |
| 33 | FirstVal, |
| 34 | SecondVal |
| 35 | }; |
| 36 | |
| 37 | typedef int NestedTypedef; |
Zachary Turner | d270d22 | 2015-02-26 23:49:23 +0000 | [diff] [blame] | 38 | |
| 39 | NestedEnum m_nested_enum; |
| 40 | NestedTypedef m_typedef; |
| 41 | bool m_bool; |
| 42 | char m_char; |
| 43 | wchar_t m_wchar_t; |
| 44 | int m_int; |
| 45 | unsigned m_unsigned; |
| 46 | long m_long; |
| 47 | unsigned long m_unsigned_long; |
| 48 | __int64 m_int64; |
| 49 | unsigned __int64 m_unsigned_int64; |
| 50 | float m_float; |
| 51 | double m_double; |
| 52 | void (*m_pfn_2_args)(int, double); |
Adrian McCarthy | 08eb343 | 2017-04-10 16:43:09 +0000 | [diff] [blame] | 53 | int m_multidimensional_array[2][3]; |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 54 | }; |
| 55 | |
| 56 | typedef int IntType; |
| 57 | typedef A ClassAType; |
| 58 | |
Zachary Turner | db18f5c | 2015-02-27 09:15:18 +0000 | [diff] [blame] | 59 | int g_global_int; |
| 60 | void *g_global_pointer = nullptr; |
| 61 | |
Adrian McCarthy | 08eb343 | 2017-04-10 16:43:09 +0000 | [diff] [blame] | 62 | typedef int int_array[3]; |
| 63 | int_array g_array = { 1, 2, 3 }; |
| 64 | int_array *g_pointer_to_array = &g_array; |
| 65 | const int *g_pointer_to_const_int = nullptr; |
| 66 | int * const g_const_pointer_to_int = nullptr; |
| 67 | const int * const g_const_pointer_to_const_int = nullptr; |
| 68 | |
Zachary Turner | a54b7dd | 2015-02-22 06:47:32 +0000 | [diff] [blame] | 69 | int main(int argc, char **argv) { |
Zachary Turner | d270d22 | 2015-02-26 23:49:23 +0000 | [diff] [blame] | 70 | // Force symbol references so the linker generates debug info |
Zachary Turner | a54b7dd | 2015-02-22 06:47:32 +0000 | [diff] [blame] | 71 | B b; |
Zachary Turner | d270d22 | 2015-02-26 23:49:23 +0000 | [diff] [blame] | 72 | MemberTest members; |
Zachary Turner | a54b7dd | 2015-02-22 06:47:32 +0000 | [diff] [blame] | 73 | auto PureAddr = &B::PureFunc; |
| 74 | auto VirtualAddr = &A::PureFunc; |
| 75 | auto RegularAddr = &A::RegularFunc; |
Zachary Turner | 29c6910 | 2015-02-23 05:58:34 +0000 | [diff] [blame] | 76 | TestEnum Enum = Value; |
| 77 | TestEnumClass EnumClass = TestEnumClass::Value10; |
| 78 | IntType Int = 12; |
| 79 | ClassAType *ClassA = &b; |
Zachary Turner | a54b7dd | 2015-02-22 06:47:32 +0000 | [diff] [blame] | 80 | return 0; |
| 81 | } |