1 // REQUIRES: x86-registered-target
2 
3 // RUN: c-index-test -write-pch %t.itanium.ast -target i686-pc-linux-gnu -fdeclspec %s
4 // RUN: c-index-test -test-print-manglings %t.itanium.ast | FileCheck --check-prefix=ITANIUM %s
5 
6 // RUN: c-index-test -write-pch %t.macho.ast -target i686-apple-darwin -fdeclspec %s
7 // RUN: c-index-test -test-print-manglings %t.macho.ast | FileCheck --check-prefix=MACHO %s
8 
9 // RUN: c-index-test -write-pch %t.msvc.ast -target i686-pc-windows %s
10 // RUN: c-index-test -test-print-manglings %t.msvc.ast | FileCheck --check-prefix=MSVC %s
11 
12 struct s {
13   s(int);
14   ~s();
15   int m(int);
16 };
17 
18 // ITANIUM: CXXConstructor=s{{.*}}[mangled=_ZN1sC2Ei] [mangled=_ZN1sC1Ei]
19 // ITANIUM: CXXDestructor=~s{{.*}}[mangled=_ZN1sD2Ev] [mangled=_ZN1sD1Ev]
20 
21 // MACHO: CXXConstructor=s{{.*}}[mangled=__ZN1sC2Ei] [mangled=__ZN1sC1Ei]
22 // MACHO: CXXDestructor=~s{{.*}}[mangled=__ZN1sD2Ev] [mangled=__ZN1sD1Ev]
23 
24 // MSVC: CXXConstructor=s{{.*}}[mangled=??0s@@QAE@H@Z]
25 // MSVC: CXXDestructor=~s{{.*}}[mangled=??1s@@QAE@XZ]
26 
27 struct t {
28   t(int);
29   virtual ~t();
30   int m(int);
31 };
32 
33 // ITANIUM: CXXConstructor=t{{.*}}[mangled=_ZN1tC2Ei] [mangled=_ZN1tC1Ei]
34 // ITANIUM: CXXDestructor=~t{{.*}}[mangled=_ZN1tD2Ev] [mangled=_ZN1tD1Ev] [mangled=_ZN1tD0Ev]
35 
36 // MACHO: CXXConstructor=t{{.*}}[mangled=__ZN1tC2Ei] [mangled=__ZN1tC1Ei]
37 // MACHO: CXXDestructor=~t{{.*}}[mangled=__ZN1tD2Ev] [mangled=__ZN1tD1Ev] [mangled=__ZN1tD0Ev]
38 
39 // MSVC: CXXConstructor=t{{.*}}[mangled=??0t@@QAE@H@Z]
40 // MSVC: CXXDestructor=~t{{.*}}[mangled=??1t@@UAE@XZ]
41 
42 struct u {
43   u();
44   virtual ~u();
45   virtual int m(int) = 0;
46 };
47 
48 // ITANIUM: CXXConstructor=u{{.*}}[mangled=_ZN1uC2Ev]
49 // ITANIUM: CXXDestructor=~u{{.*}}[mangled=_ZN1uD2Ev] [mangled=_ZN1uD1Ev] [mangled=_ZN1uD0Ev]
50 
51 // MACHO: CXXConstructor=u{{.*}}[mangled=__ZN1uC2Ev]
52 // MACHO: CXXDestructor=~u{{.*}}[mangled=__ZN1uD2Ev] [mangled=__ZN1uD1Ev] [mangled=__ZN1uD0Ev]
53 
54 // MSVC: CXXConstructor=u{{.*}}[mangled=??0u@@QAE@XZ]
55 // MSVC: CXXDestructor=~u{{.*}}[mangled=??1u@@UAE@XZ]
56 
57 struct v {
58   __declspec(dllexport) v(int = 0);
59 };
60 
61 // ITANIUM: CXXConstructor=v{{.*}}[mangled=_ZN1vC2Ei] [mangled=_ZN1vC1Ei]
62 
63 // MACHO: CXXConstructor=v{{.*}}[mangled=__ZN1vC2Ei] [mangled=__ZN1vC1Ei]
64 
65 // MSVC: CXXConstructor=v{{.*}}[mangled=??0v@@QAE@H@Z] [mangled=??_Fv@@QAEXXZ]
66 
67 struct w {
68   virtual int m(int);
69 };
70 
71 // ITANIUM: CXXMethod=m{{.*}} (virtual) [mangled=_ZN1w1mEi]
72 
73 // MACHO: CXXMethod=m{{.*}} (virtual) [mangled=__ZN1w1mEi]
74 
75 // MSVC: CXXMethod=m{{.*}} (virtual) [mangled=?m@w@@UAEHH@Z]
76 
77 struct x {
78   virtual int m(int);
79 };
80 
81 // ITANIUM: CXXMethod=m{{.*}} (virtual) [mangled=_ZN1x1mEi]
82 
83 // MACHO: CXXMethod=m{{.*}} (virtual) [mangled=__ZN1x1mEi]
84 
85 // MSVC: CXXMethod=m{{.*}} (virtual) [mangled=?m@x@@UAEHH@Z]
86 
87 struct y : w, x {
88   virtual int m(int);
89 };
90 
91 // ITANIUM: CXXMethod=m{{.*}} (virtual) {{.*}} [mangled=_ZN1y1mEi] [mangled=_ZThn4_N1y1mEi]
92 
93 // MACHO: CXXMethod=m{{.*}} (virtual) {{.*}} [mangled=__ZN1y1mEi] [mangled=__ZThn4_N1y1mEi]
94 
95 // MSVC: CXXMethod=m{{.*}} (virtual) {{.*}} [mangled=?m@y@@UAEHH@Z] [mangled=?m@y@@W3AEHH@Z]
96 
97