1 // REQUIRES: x86-registered-target
2 // RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
3 // RUN: -interface-stub-version=experimental-tapi-elf-v1 %s | \
4 // RUN: FileCheck -check-prefix=CHECK-TAPI %s
5 
6 // RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
7 // RUN: -interface-stub-version=experimental-tapi-elf-v1 %s | \
8 // RUN: FileCheck -check-prefix=CHECK-TAPI2 %s
9 // RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | \
10 // RUN: llvm-readelf -s - 2>&1 | \
11 // RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
12 
13 // For the following:
14 // g()
15 // n::S<int>::S()
16 // n::S<int>::~S()
17 // n::S<int>::func() const
18 // n::S<int>::S(n::S<int> const&)
19 
20 // We expect these manglings:
21 // CHECK-TAPI: Symbols:
22 // CHECK-TAPI-NOT: _ZNK1n1SIiEclEv
23 // CHECK-TAPI2: Symbols:
24 // CHECK-TAPI2: _Z1g
25 
26 // CHECK-SYMBOLS-DAG: FUNC    GLOBAL DEFAULT    {{[0-9]}} _Z1g
27 // CHECK-SYMBOLS-DAG: FUNC    WEAK   HIDDEN     {{[0-9]}} _ZNK1n1SIiEclEv
28 
29 namespace n {
30 template <typename T>
31 struct __attribute__((__visibility__("default"))) S {
32   S() = default;
33   ~S() = default;
34   int __attribute__((__visibility__(("default")))) func() const {
35     return 1844;
36   }
37   int __attribute__((__visibility__(("hidden")))) operator()() const {
38     return 1863;
39   }
40 };
41 } // namespace n
42 
43 void g() { n::S<int>()(); }
44