[cfe-commits] r160339 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/CodeGenCXX/visibility.cpp
Rafael Espindola
rafael.espindola at gmail.com
Mon Jul 16 21:22:25 PDT 2012
Author: rafael
Date: Mon Jul 16 23:22:25 2012
New Revision: 160339
URL: http://llvm.org/viewvc/llvm-project?rev=160339&view=rev
Log:
Record visibility pragmas when we see a tag declaration. We might use it
to build a type before seeing the definition.
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=160339&r1=160338&r2=160339&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jul 16 23:22:25 2012
@@ -8880,6 +8880,10 @@
if (Attr)
ProcessDeclAttributeList(S, New, Attr);
+ // If there's a #pragma GCC visibility in scope, set the visibility of this
+ // record.
+ AddPushedVisibilityAttribute(New);
+
// If we're declaring or defining a tag in function prototype scope
// in C, note that this type can only be used within the function.
if (Name && S->isFunctionPrototypeScope() && !getLangOpts().CPlusPlus)
Modified: cfe/trunk/test/CodeGenCXX/visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility.cpp?rev=160339&r1=160338&r2=160339&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/visibility.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility.cpp Mon Jul 16 23:22:25 2012
@@ -1061,3 +1061,19 @@
// CHECK: declare hidden void @_ZN6test573fooIiE3zedEv
// CHECK-HIDDEN: declare hidden void @_ZN6test573fooIiE3zedEv
}
+
+namespace test58 {
+#pragma GCC visibility push(hidden)
+ struct foo;
+ template<typename T>
+ struct __attribute__((visibility("default"))) bar {
+ static void zed() {
+ }
+ };
+ void bah() {
+ bar<foo>::zed();
+ }
+#pragma GCC visibility pop
+ // CHECK: define linkonce_odr hidden void @_ZN6test583barINS_3fooEE3zedEv
+ // CHECK-HIDDEN: define linkonce_odr hidden void @_ZN6test583barINS_3fooEE3zedEv
+}
More information about the cfe-commits
mailing list