[cfe-commits] r157486 - in /cfe/trunk: lib/AST/Decl.cpp test/CodeGenCXX/visibility.cpp
Rafael Espindola
rafael.espindola at gmail.com
Fri May 25 10:22:33 PDT 2012
Author: rafael
Date: Fri May 25 12:22:33 2012
New Revision: 157486
URL: http://llvm.org/viewvc/llvm-project?rev=157486&view=rev
Log:
Don't ignore linkage when ignoring visibility in the instantiation of a
method template.
Modified:
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/test/CodeGenCXX/visibility.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=157486&r1=157485&r2=157486&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri May 25 12:22:33 2012
@@ -535,12 +535,20 @@
// the template parameters and arguments.
if (FunctionTemplateSpecializationInfo *spec
= MD->getTemplateSpecializationInfo()) {
+ const TemplateArgumentList &TemplateArgs = *spec->TemplateArguments;
+ LinkageInfo ArgsLV = getLVForTemplateArgumentList(TemplateArgs,
+ OnlyTemplate);
+ TemplateParameterList *TemplateParams =
+ spec->getTemplate()->getTemplateParameters();
+ LinkageInfo ParamsLV = getLVForTemplateParameterList(TemplateParams);
if (shouldConsiderTemplateVis(MD, spec)) {
- LV.mergeWithMin(getLVForTemplateArgumentList(*spec->TemplateArguments,
- OnlyTemplate));
+ LV.mergeWithMin(ArgsLV);
if (!OnlyTemplate)
- LV.merge(getLVForTemplateParameterList(
- spec->getTemplate()->getTemplateParameters()));
+ LV.merge(ParamsLV);
+ } else {
+ LV.mergeLinkage(ArgsLV);
+ if (!OnlyTemplate)
+ LV.mergeLinkage(ParamsLV);
}
}
Modified: cfe/trunk/test/CodeGenCXX/visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility.cpp?rev=157486&r1=157485&r2=157486&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/visibility.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility.cpp Fri May 25 12:22:33 2012
@@ -864,3 +864,20 @@
// CHECK: define internal void @_ZN6test463fooINS_12_GLOBAL__N_13barEEEvv
// CHECK-HIDDEN: define internal void @_ZN6test463fooINS_12_GLOBAL__N_13barEEEvv
}
+
+namespace test47 {
+ struct foo {
+ template <typename T>
+ static void bar() {
+ }
+ };
+ namespace {
+ struct zed;
+ }
+ template __attribute__((visibility("default"))) void foo::bar<zed>();
+ void baz() {
+ foo::bar<zed>();
+ }
+ // CHECK: define internal void @_ZN6test473foo3barINS_12_GLOBAL__N_13zedEEEvv
+ // CHECK-HIDDEN: define internal void @_ZN6test473foo3barINS_12_GLOBAL__N_13zedEEEvv
+}
More information about the cfe-commits
mailing list