diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-07-11 02:15:51 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-07-11 02:15:51 +0000 |
commit | f2f15b3bc6820469024db170c87ffe885ec53cf9 (patch) | |
tree | 623921033ba05d8c71e8ea1d325b719d584d91da | |
parent | 3d40f96394fb30b70ba83bdfd10f3ed69530b0e5 (diff) |
Don't process #pragma visibility during instantiation. The visibility of the
instantiation depends on the template, its arguments and parameters, but not
where it is instantiated.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160034 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 3 | ||||
-rw-r--r-- | test/CodeGenCXX/visibility.cpp | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index f9a487270b..576cbd150a 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -10062,7 +10062,8 @@ void Sema::ActOnFields(Scope* S, // If there's a #pragma GCC visibility in scope, and this isn't a subclass, // set the visibility of this record. - if (Record && !Record->getDeclContext()->isRecord()) + if (Record && !Record->getDeclContext()->isRecord() && + !isa<ClassTemplateSpecializationDecl>(Record)) AddPushedVisibilityAttribute(Record); } diff --git a/test/CodeGenCXX/visibility.cpp b/test/CodeGenCXX/visibility.cpp index a398a45e58..60a77927ff 100644 --- a/test/CodeGenCXX/visibility.cpp +++ b/test/CodeGenCXX/visibility.cpp @@ -974,3 +974,16 @@ namespace test52 { // CHECK: define internal void @_ZN6test523zedILPNS_12_GLOBAL__N_13fooE0EEEvv // CHECK-HIDDEN: define internal void @_ZN6test523zedILPNS_12_GLOBAL__N_13fooE0EEEvv } + +namespace test53 { + template<typename _Tp > struct vector { + static void _M_fill_insert(); + }; +#pragma GCC visibility push(hidden) + void foo() { + vector<unsigned>::_M_fill_insert(); + } +#pragma GCC visibility pop + // CHECK: declare void @_ZN6test536vectorIjE14_M_fill_insertEv + // CHECK-HIDDEN: declare void @_ZN6test536vectorIjE14_M_fill_insertEv +} |