An attribute in a explicit template installation should take precedence over

the tempale arguments in deciding the visibility.

This agrees with gcc 4.7.

Found by trying to build chrome with component=shared_library with 155314
reverted.

llvm-svn: 155316
This commit is contained in:
Rafael Espindola 2012-04-22 15:31:59 +00:00
parent 6c6cdec3de
commit bbc5cbc410
2 changed files with 15 additions and 2 deletions

View File

@ -407,8 +407,8 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
// The arguments at which the template was instantiated.
const TemplateArgumentList &TemplateArgs = spec->getTemplateArgs();
LV.mergeWithMin(getLVForTemplateArgumentList(TemplateArgs,
OnlyTemplate));
LV.merge(getLVForTemplateArgumentList(TemplateArgs,
OnlyTemplate));
}
}

View File

@ -660,3 +660,16 @@ namespace test32 {
// CHECK: define void @_ZN6test321A1B3bazEv
// CHECK-HIDDEN: define void @_ZN6test321A1B3bazEv
}
namespace test33 {
template<typename T>
class foo {
void bar() {}
int a;
};
struct __attribute__((visibility("hidden"))) zed {
};
template class __attribute__((visibility("default"))) foo<zed>;
// CHECK: define weak_odr void @_ZN6test333fooINS_3zedEE3barEv
// CHECK-HIDDEN: define weak_odr void @_ZN6test333fooINS_3zedEE3barEv
}