[cfe-commits] r160176 - in /cfe/trunk: lib/Sema/SemaTemplate.cpp test/CodeGenCXX/visibility.cpp
Rafael Espindola
rafael.espindola at gmail.com
Fri Jul 13 11:04:45 PDT 2012
Author: rafael
Date: Fri Jul 13 13:04:45 2012
New Revision: 160176
URL: http://llvm.org/viewvc/llvm-project?rev=160176&view=rev
Log:
Apply visibility pragmas to class template declarations. This is needed because
we might use the declaration to build a type before seeing the definition.
Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/CodeGenCXX/visibility.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=160176&r1=160175&r2=160176&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Fri Jul 13 13:04:45 2012
@@ -1102,6 +1102,8 @@
if (Attr)
ProcessDeclAttributeList(S, NewClass, Attr);
+ AddPushedVisibilityAttribute(NewClass);
+
if (TUK != TUK_Friend)
PushOnScopeChains(NewTemplate, S);
else {
Modified: cfe/trunk/test/CodeGenCXX/visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility.cpp?rev=160176&r1=160175&r2=160176&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/visibility.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility.cpp Fri Jul 13 13:04:45 2012
@@ -1044,3 +1044,20 @@
// CHECK: declare hidden void @_ZN6test563fooIiE3barEv
// CHECK-HIDDEN: declare hidden void @_ZN6test563fooIiE3barEv
}
+
+namespace test57 {
+#pragma GCC visibility push(hidden)
+ template <class T>
+ struct foo;
+ void bar(foo<int>*);
+ template <class T>
+ struct foo {
+ static void zed();
+ };
+ void bah() {
+ foo<int>::zed();
+ }
+#pragma GCC visibility pop
+ // CHECK: declare hidden void @_ZN6test573fooIiE3zedEv
+ // CHECK-HIDDEN: declare hidden void @_ZN6test573fooIiE3zedEv
+}
More information about the cfe-commits
mailing list