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
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
16 struct 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
25 struct S {
func1S26   virtual HIDDEN  int func1() const { return 42; }
func2S27   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
34 struct R {
35   virtual HIDDEN  int func1() const = 0;
36   virtual DEFAULT int func2() const = 0;
37 };
38 
39 int a = q.func1() + q.func2();
40 
41