diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-02-26 19:33:14 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-02-26 19:33:14 +0000 |
commit | d3b2f0ac1cedad284d860acd652f28a05bcbcbed (patch) | |
tree | faf6df298dabcae78b1c3084b34ca74412aa2de7 /test | |
parent | d7a60ad800d64b7c444b26a58e76ec337dbd7bc2 (diff) |
Use the most recent decl in getExplicitVisibility.
Now that implicitly hidden template arguments can make an instantiation hidden,
it is important to look at more than just the canonical decl of the argument
in order to see if an attribute is available in a more recent decl.
This has the disadvantage of exposing when getExplicitVisibility is called,
but lets us handle cases like
template <typename T>
struct __attribute__((visibility("default"))) barT {
static void zed() {}
};
class foo;
class __attribute__((visibility("default"))) foo;
template struct barT<foo>;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176112 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGenCXX/visibility.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/CodeGenCXX/visibility.cpp b/test/CodeGenCXX/visibility.cpp index b9dec17301..5511da7cb3 100644 --- a/test/CodeGenCXX/visibility.cpp +++ b/test/CodeGenCXX/visibility.cpp @@ -1227,3 +1227,36 @@ namespace test65 { template class C<B<A>::InnerT>; } + +namespace test66 { + template <typename T> + struct __attribute__((visibility("default"))) barT { + static void zed() {} + }; + class foo; + class __attribute__((visibility("default"))) foo; + template struct barT<foo>; + // CHECK: define weak_odr void @_ZN6test664barTINS_3fooEE3zedEv + // CHECK-HIDDEN: define weak_odr void @_ZN6test664barTINS_3fooEE3zedEv + + template <int* I> + struct __attribute__((visibility("default"))) barI { + static void zed() {} + }; + extern int I; + extern int I __attribute__((visibility("default"))); + template struct barI<&I>; + // CHECK: define weak_odr void @_ZN6test664barIIXadL_ZNS_1IEEEE3zedEv + // CHECK-HIDDEN: define weak_odr void @_ZN6test664barIIXadL_ZNS_1IEEEE3zedEv + + typedef void (*fType)(void); + template<fType F> + struct __attribute__((visibility("default"))) barF { + static void zed() {} + }; + void F(); + void F() __attribute__((visibility("default")));; + template struct barF<F>; + // CHECK: define weak_odr void @_ZN6test664barFIXadL_ZNS_1FEvEEE3zedEv + // CHECK-HIDDEN: define weak_odr void @_ZN6test664barFIXadL_ZNS_1FEvEEE3zedEv +} |