blob: cea58aac87718b8da671f994360eef64edda034e [file] [log] [blame]
Puyan Lotfi678e19d2019-06-20 18:28:21 +00001// REQUIRES: x86-registered-target
Puyan Lotfie7821922019-11-13 23:58:09 -05002// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs %s | \
Puyan Lotfi68f29da2019-06-20 16:59:48 +00003// RUN: FileCheck -check-prefix=CHECK-TAPI %s
Puyan Lotfie7821922019-11-13 23:58:09 -05004// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs %s | \
Puyan Lotfi68f29da2019-06-20 16:59:48 +00005// RUN: FileCheck -check-prefix=CHECK-TAPI2 %s
6// RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | \
7// RUN: llvm-readelf -s - 2>&1 | FileCheck -check-prefix=CHECK-SYMBOLS %s
8
9#define HIDDEN __attribute__((__visibility__(("hidden"))))
10#define DEFAULT __attribute__((__visibility__(("default"))))
11
12// CHECK-TAPI-NOT: _ZNK1Q5func1Ev
13// CHECK-TAPI-NOT: _ZNK1Q5func2Ev
14// CHECK-SYMBOLS-DAG: NOTYPE GLOBAL HIDDEN {{.*}} _ZNK1Q5func1Ev
15// CHECK-SYMBOLS-DAG: NOTYPE GLOBAL DEFAULT {{.*}} _ZNK1Q5func2Ev
16struct Q {
17 virtual HIDDEN int func1() const;
18 virtual DEFAULT int func2() const;
19} q;
20
21// CHECK-TAPI-NOT: _ZNK1S5func1Ev
22// CHECK-TAPI2-DAG: _ZNK1S5func2Ev
23// CHECK-SYMBOLS-DAG: FUNC WEAK HIDDEN {{.*}} _ZNK1S5func1Ev
24// CHECK-SYMBOLS-DAG: FUNC WEAK DEFAULT {{.*}} _ZNK1S5func2Ev
25struct S {
26 virtual HIDDEN int func1() const { return 42; }
27 virtual DEFAULT int func2() const { return 42; }
28} s;
29
30// CHECK-TAPI-NOT: _ZNK1R5func1Ev
31// CHECK-TAPI-NOT: _ZNK1R5func2Ev
32// CHECK-SYMBOLS-NOT: _ZNK1R5func1Ev
33// CHECK-SYMBOLS-NOT: _ZNK1R5func2Ev
34struct R {
35 virtual HIDDEN int func1() const = 0;
36 virtual DEFAULT int func2() const = 0;
37};
38
39int a = q.func1() + q.func2();
40