1// RUN: %clang_cc1 -flto -triple x86_64-unknown-linux -std=c++11 -fms-extensions -fvisibility hidden -fwhole-program-vtables -emit-llvm -o - %s | FileCheck --check-prefix=ITANIUM %s
2// RUN: %clang_cc1 -flto -triple x86_64-pc-windows-msvc -std=c++11 -fms-extensions -fwhole-program-vtables -emit-llvm -o - %s | FileCheck --check-prefix=MS --check-prefix=MS-STD %s
3// RUN: %clang_cc1 -flto -triple x86_64-pc-windows-msvc -std=c++11 -fms-extensions -fwhole-program-vtables -flto-visibility-public-std -emit-llvm -o - %s | FileCheck --check-prefix=MS --check-prefix=MS-NOSTD %s
4
5struct C1 {
6  virtual void f();
7};
8
9struct __attribute__((visibility("default"))) C2 {
10  virtual void f();
11};
12
13struct __declspec(dllexport) C3 {
14  virtual void f();
15};
16
17struct __declspec(dllimport) C4 {
18  virtual void f();
19};
20
21struct [[clang::lto_visibility_public]] C5 {
22  virtual void f();
23};
24
25struct __declspec(uuid("00000000-0000-0000-0000-000000000000")) C6 {
26  virtual void f();
27};
28
29namespace std {
30
31struct C7 {
32  virtual void f();
33  struct C8 {
34    virtual void f();
35  };
36};
37
38}
39
40extern "C++" {
41
42namespace stdext {
43
44struct C9 {
45  virtual void f();
46};
47
48}
49
50}
51
52namespace other {
53
54struct C10 {
55  virtual void f();
56};
57
58}
59
60namespace {
61
62struct C11 {
63  virtual void f();
64};
65
66}
67
68void f(C1 *c1, C2 *c2, C3 *c3, C4 *c4, C5 *c5, C6 *c6, std::C7 *c7,
69       std::C7::C8 *c8, stdext::C9 *c9, other::C10 *c10) {
70  // ITANIUM: type.test{{.*}}!"_ZTS2C1"
71  // MS: type.test{{.*}}!"?AUC1@@"
72  c1->f();
73  // ITANIUM-NOT: type.test{{.*}}!"_ZTS2C2"
74  // MS: type.test{{.*}}!"?AUC2@@"
75  c2->f();
76  // ITANIUM: type.test{{.*}}!"_ZTS2C3"
77  // MS-NOT: type.test{{.*}}!"?AUC3@@"
78  c3->f();
79  // ITANIUM: type.test{{.*}}!"_ZTS2C4"
80  // MS-NOT: type.test{{.*}}!"?AUC4@@"
81  c4->f();
82  // ITANIUM-NOT: type.test{{.*}}!"_ZTS2C5"
83  // MS-NOT: type.test{{.*}}!"?AUC5@@"
84  c5->f();
85  // ITANIUM-NOT: type.test{{.*}}!"_ZTS2C6"
86  // MS-NOT: type.test{{.*}}!"?AUC6@@"
87  c6->f();
88  // ITANIUM: type.test{{.*}}!"_ZTSSt2C7"
89  // MS-STD: type.test{{.*}}!"?AUC7@std@@"
90  // MS-NOSTD-NOT: type.test{{.*}}!"?AUC7@std@@"
91  c7->f();
92  // ITANIUM: type.test{{.*}}!"_ZTSNSt2C72C8E"
93  // MS-STD: type.test{{.*}}!"?AUC8@C7@std@@"
94  // MS-NOSTD-NOT: type.test{{.*}}!"?AUC8@C7@std@@"
95  c8->f();
96  // ITANIUM: type.test{{.*}}!"_ZTSN6stdext2C9E"
97  // MS-STD: type.test{{.*}}!"?AUC9@stdext@@"
98  // MS-NOSTD-NOT: type.test{{.*}}!"?AUC9@stdext@@"
99  c9->f();
100  // ITANIUM: type.test{{.*}}!"_ZTSN5other3C10E"
101  // MS: type.test{{.*}}!"?AUC10@other@@"
102  c10->f();
103  // ITANIUM: type.test{{.*}}!{{[0-9]}}
104  // MS: type.test{{.*}}!{{[0-9]}}
105  C11 *c11;
106  c11->f();
107}
108