[ELF] Reorder SectionBase/InputSectionBase members
[llvm-project.git] / clang / test / InterfaceStubs / virtual.cpp
blobcea58aac87718b8da671f994360eef64edda034e
1 // REQUIRES: x86-registered-target
2 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs %s | \
3 // RUN: FileCheck -check-prefix=CHECK-TAPI %s
4 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs %s | \
5 // 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
9 #define HIDDEN __attribute__((__visibility__(("hidden"))))
10 #define DEFAULT __attribute__((__visibility__(("default"))))
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
16 struct Q {
17 virtual HIDDEN int func1() const;
18 virtual DEFAULT int func2() const;
19 } q;
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
25 struct S {
26 virtual HIDDEN int func1() const { return 42; }
27 virtual DEFAULT int func2() const { return 42; }
28 } s;
30 // CHECK-TAPI-NOT: _ZNK1R5func1Ev
31 // CHECK-TAPI-NOT: _ZNK1R5func2Ev
32 // CHECK-SYMBOLS-NOT: _ZNK1R5func1Ev
33 // CHECK-SYMBOLS-NOT: _ZNK1R5func2Ev
34 struct R {
35 virtual HIDDEN int func1() const = 0;
36 virtual DEFAULT int func2() const = 0;
39 int a = q.func1() + q.func2();