summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/Decl.cpp7
-rw-r--r--clang/test/CodeGenCXX/linkage.cpp11
2 files changed, 15 insertions, 3 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 57eda43a952..089622fb186 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -789,13 +789,14 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D,
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.
diff --git a/clang/test/CodeGenCXX/linkage.cpp b/clang/test/CodeGenCXX/linkage.cpp
index 9d66934a243..a481b00123b 100644
--- a/clang/test/CodeGenCXX/linkage.cpp
+++ b/clang/test/CodeGenCXX/linkage.cpp
@@ -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(); }
+}
OpenPOWER on IntegriCloud