Fix the linkage of local types in inline VisibleNoLinkage functions.

We were handling only local types in inline External functions before.

llvm-svn: 182737
This commit is contained in:
Rafael Espindola 2013-05-27 14:50:21 +00:00
parent 1d66e366e9
commit 111bb2ef8d
2 changed files with 17 additions and 1 deletions

View File

@ -1070,7 +1070,7 @@ static LinkageInfo getLVForLocalDecl(const NamedDecl *D,
if (!FD || !FD->isInlined())
return LinkageInfo::none();
LinkageInfo LV = FD->getLinkageAndVisibility();
if (LV.getLinkage() != ExternalLinkage)
if (!isExternallyVisible(LV.getLinkage()))
return LinkageInfo::none();
return LinkageInfo(VisibleNoLinkage, LV.getVisibility(),
LV.isVisibilityExplicit());

View File

@ -143,3 +143,19 @@ namespace test11 {
}
void *h() { return g(); }
}
namespace test12 {
// CHECK-DAG: define linkonce_odr void @_ZN6test123fooIZNS_3barIZNS_3zedEvE2S2EEPvvE2S1EEvv
template <typename T> void foo() {}
template <typename T> inline void *bar() {
enum S1 {
};
return reinterpret_cast<void *>(foo<S1>);
}
inline void *zed() {
enum S2 {
};
return reinterpret_cast<void *>(bar<S2>);
}
void *h() { return zed(); }
}