r182737 - Fix the linkage of local types in inline VisibleNoLinkage functions.
Rafael Espindola
rafael.espindola at gmail.com
Mon May 27 07:50:21 PDT 2013
Author: rafael
Date: Mon May 27 09:50:21 2013
New Revision: 182737
URL: http://llvm.org/viewvc/llvm-project?rev=182737&view=rev
Log:
Fix the linkage of local types in inline VisibleNoLinkage functions.
We were handling only local types in inline External functions before.
Modified:
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/test/CodeGenCXX/linkage.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=182737&r1=182736&r2=182737&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Mon May 27 09:50:21 2013
@@ -1070,7 +1070,7 @@ static LinkageInfo getLVForLocalDecl(con
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());
Modified: cfe/trunk/test/CodeGenCXX/linkage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/linkage.cpp?rev=182737&r1=182736&r2=182737&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/linkage.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/linkage.cpp Mon May 27 09:50:21 2013
@@ -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(); }
+}
More information about the cfe-commits
mailing list