[cfe-commits] r160105 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/CodeGenCXX/visibility.cpp
Rafael Espindola
rafael.espindola at gmail.com
Wed Jul 11 21:47:34 PDT 2012
Author: rafael
Date: Wed Jul 11 23:47:34 2012
New Revision: 160105
URL: http://llvm.org/viewvc/llvm-project?rev=160105&view=rev
Log:
Process #pragma visibility early in the parsing of class definitions. Fixes
pr13338.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/CodeGenCXX/visibility.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=160105&r1=160104&r2=160105&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Jul 11 23:47:34 2012
@@ -8919,6 +8919,10 @@
PushDeclContext(S, Tag);
ActOnDocumentableDecl(TagD);
+
+ // If there's a #pragma GCC visibility in scope, set the visibility of this
+ // record.
+ AddPushedVisibilityAttribute(Tag);
}
Decl *Sema::ActOnObjCContainerStartDefinition(Decl *IDecl) {
@@ -8983,10 +8987,6 @@
if (isa<CXXRecordDecl>(Tag))
FieldCollector->FinishClass();
- // If there's a #pragma GCC visibility in scope, and this isn't a subclass,
- // set the visibility of this record.
- AddPushedVisibilityAttribute(Tag);
-
// Exit this scope of this tag's definition.
PopDeclContext();
Modified: cfe/trunk/test/CodeGenCXX/visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility.cpp?rev=160105&r1=160104&r2=160105&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/visibility.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility.cpp Wed Jul 11 23:47:34 2012
@@ -1001,3 +1001,20 @@
// CHECK: declare hidden void @_ZN6test536vectorINS_3zedEE14_M_fill_insertEv
// CHECK-HIDDEN: declare hidden void @_ZN6test536vectorINS_3zedEE14_M_fill_insertEv
}
+
+namespace test54 {
+ template <class T>
+ struct foo {
+ static void bar();
+ };
+#pragma GCC visibility push(hidden)
+ class zed {
+ zed(const zed &);
+ };
+ void bah() {
+ foo<zed>::bar();
+ }
+#pragma GCC visibility pop
+ // CHECK: declare hidden void @_ZN6test543fooINS_3zedEE3barEv
+ // CHECK-HIDDEN: declare hidden void @_ZN6test543fooINS_3zedEE3barEv
+}
More information about the cfe-commits
mailing list