[cfe-commits] r117567 - in /cfe/trunk: lib/AST/Decl.cpp test/CodeGenCXX/visibility-inlines-hidden.cpp
John McCall
rjmccall at apple.com
Thu Oct 28 11:10:36 PDT 2010
Author: rjmccall
Date: Thu Oct 28 13:10:36 2010
New Revision: 117567
URL: http://llvm.org/viewvc/llvm-project?rev=117567&view=rev
Log:
Don't apply -fvisibility-inlines-hidden to extern templates.
Part 2 of rdar://problem/8595231
Modified:
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=117567&r1=117566&r2=117567&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Thu Oct 28 13:10:36 2010
@@ -456,7 +456,9 @@
// member functions get "hidden" visibility if they don't have an
// explicit visibility attribute.
if (!VA && MD->isInlined() && LV.second > HiddenVisibility &&
- D->getASTContext().getLangOptions().InlineVisibilityHidden)
+ D->getASTContext().getLangOptions().InlineVisibilityHidden &&
+ MD->getTemplateSpecializationKind()
+ != TSK_ExplicitInstantiationDeclaration)
LV.second = HiddenVisibility;
// Similarly for member class template specializations.
Modified: cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp?rev=117567&r1=117566&r2=117567&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp Thu Oct 28 13:10:36 2010
@@ -1,4 +1,9 @@
-// RUN: %clang_cc1 -fvisibility-inlines-hidden -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fvisibility-inlines-hidden -emit-llvm -o - %s -O2 -disable-llvm-optzns | FileCheck %s
+
+// The trickery with optimization in the run line is to get IR
+// generation to emit available_externally function bodies, but not
+// actually inline them (and thus remove the emitted bodies).
+
struct X0 {
void __attribute__((visibility("default"))) f1() { }
void f2() { }
@@ -29,7 +34,9 @@
void f2() { }
};
-void use(X0 *x0, X1<int> *x1, X2 *x2) {
+extern template struct X1<float>;
+
+void use(X0 *x0, X1<int> *x1, X2 *x2, X1<float> *x3) {
// CHECK: define linkonce_odr void @_ZN2X02f1Ev
x0->f1();
// CHECK: define linkonce_odr hidden void @_ZN2X02f2Ev
@@ -54,4 +61,6 @@
x1->X1::f6();
// CHECK: define linkonce_odr hidden void @_ZN2X22f2Ev
x2->f2();
+ // CHECK: define available_externally void @_ZN2X1IfE2f2Ev
+ x3->f2();
}
More information about the cfe-commits
mailing list