xref: /llvm-project/clang/test/InterfaceStubs/class-template-specialization.cpp (revision e782192d5e6540b0cbb957a6b738d98e24c88ee3)
1678e19d8SPuyan Lotfi // REQUIRES: x86-registered-target
2*e782192dSPuyan Lotfi // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs %s | \
368f29dacSPuyan Lotfi // RUN: FileCheck -check-prefix=CHECK-TAPI %s
468f29dacSPuyan Lotfi 
5*e782192dSPuyan Lotfi // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs %s | \
668f29dacSPuyan Lotfi // RUN: FileCheck -check-prefix=CHECK-TAPI2 %s
7*e782192dSPuyan Lotfi 
8*e782192dSPuyan Lotfi // RUN: %clang -target x86_64-unknown-linux-gnu -c -o - %s | llvm-readelf -s - 2>&1 | \
968f29dacSPuyan Lotfi // RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
1068f29dacSPuyan Lotfi 
1168f29dacSPuyan Lotfi // For the following:
1268f29dacSPuyan Lotfi // g()
1368f29dacSPuyan Lotfi // n::S<int>::S()
1468f29dacSPuyan Lotfi // n::S<int>::~S()
1568f29dacSPuyan Lotfi // n::S<int>::func() const
1668f29dacSPuyan Lotfi // n::S<int>::S(n::S<int> const&)
1768f29dacSPuyan Lotfi 
1868f29dacSPuyan Lotfi // We expect these manglings:
1968f29dacSPuyan Lotfi // CHECK-TAPI: Symbols:
2068f29dacSPuyan Lotfi // CHECK-TAPI-NOT: _ZNK1n1SIiEclEv
2168f29dacSPuyan Lotfi // CHECK-TAPI2: Symbols:
2268f29dacSPuyan Lotfi // CHECK-TAPI2: _Z1g
2368f29dacSPuyan Lotfi 
2468f29dacSPuyan Lotfi // CHECK-SYMBOLS-DAG: FUNC    GLOBAL DEFAULT    {{[0-9]}} _Z1g
2568f29dacSPuyan Lotfi // CHECK-SYMBOLS-DAG: FUNC    WEAK   HIDDEN     {{[0-9]}} _ZNK1n1SIiEclEv
2668f29dacSPuyan Lotfi 
2768f29dacSPuyan Lotfi namespace n {
2868f29dacSPuyan Lotfi template <typename T>
2968f29dacSPuyan Lotfi struct __attribute__((__visibility__("default"))) S {
3068f29dacSPuyan Lotfi   S() = default;
3168f29dacSPuyan Lotfi   ~S() = default;
funcn::S3268f29dacSPuyan Lotfi   int __attribute__((__visibility__(("default")))) func() const {
3368f29dacSPuyan Lotfi     return 1844;
3468f29dacSPuyan Lotfi   }
operator ()n::S3568f29dacSPuyan Lotfi   int __attribute__((__visibility__(("hidden")))) operator()() const {
3668f29dacSPuyan Lotfi     return 1863;
3768f29dacSPuyan Lotfi   }
3868f29dacSPuyan Lotfi };
3968f29dacSPuyan Lotfi } // namespace n
4068f29dacSPuyan Lotfi 
g()4168f29dacSPuyan Lotfi void g() { n::S<int>()(); }
42