r182750 - Propagate VisibleNoLinkage down to class members.
Rafael Espindola
rafael.espindola at gmail.com
Mon May 27 19:22:10 PDT 2013
Author: rafael
Date: Mon May 27 21:22:10 2013
New Revision: 182750
URL: http://llvm.org/viewvc/llvm-project?rev=182750&view=rev
Log:
Propagate VisibleNoLinkage down to class members.
Fixes PR16114.
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=182750&r1=182749&r2=182750&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Mon May 27 21:22:10 2013
@@ -789,13 +789,14 @@ static LinkageInfo getLVForClassMember(c
LinkageInfo classLV =
getLVForDecl(cast<RecordDecl>(D->getDeclContext()), classComputation);
- if (!isExternalFormalLinkage(classLV.getLinkage()))
- return LinkageInfo::none();
-
// If the class already has unique-external linkage, we can't improve.
if (classLV.getLinkage() == UniqueExternalLinkage)
return LinkageInfo::uniqueExternal();
+ if (!isExternallyVisible(classLV.getLinkage()))
+ return LinkageInfo::none();
+
+
// Otherwise, don't merge in classLV yet, because in certain cases
// we need to completely ignore the visibility from it.
Modified: cfe/trunk/test/CodeGenCXX/linkage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/linkage.cpp?rev=182750&r1=182749&r2=182750&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/linkage.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/linkage.cpp Mon May 27 21:22:10 2013
@@ -159,3 +159,14 @@ namespace test12 {
}
void *h() { return zed(); }
}
+
+namespace test13 {
+ // CHECK-DAG: define linkonce_odr void @_ZZN6test133fooEvEN1S3barEv(
+ inline void *foo() {
+ struct S {
+ static void bar() {}
+ };
+ return (void *)S::bar;
+ }
+ void *zed() { return foo(); }
+}
More information about the cfe-commits
mailing list