forked from OSchip/llvm-project
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:
parent
1d66e366e9
commit
111bb2ef8d
|
@ -1070,7 +1070,7 @@ static LinkageInfo getLVForLocalDecl(const NamedDecl *D,
|
||||||
if (!FD || !FD->isInlined())
|
if (!FD || !FD->isInlined())
|
||||||
return LinkageInfo::none();
|
return LinkageInfo::none();
|
||||||
LinkageInfo LV = FD->getLinkageAndVisibility();
|
LinkageInfo LV = FD->getLinkageAndVisibility();
|
||||||
if (LV.getLinkage() != ExternalLinkage)
|
if (!isExternallyVisible(LV.getLinkage()))
|
||||||
return LinkageInfo::none();
|
return LinkageInfo::none();
|
||||||
return LinkageInfo(VisibleNoLinkage, LV.getVisibility(),
|
return LinkageInfo(VisibleNoLinkage, LV.getVisibility(),
|
||||||
LV.isVisibilityExplicit());
|
LV.isVisibilityExplicit());
|
||||||
|
|
|
@ -143,3 +143,19 @@ namespace test11 {
|
||||||
}
|
}
|
||||||
void *h() { return g(); }
|
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(); }
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue