R34811: Allow visibilities other than 'default' for VisibleNoLinkage entities.
llvm-svn: 314754
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index df30426..6e5f638 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -817,9 +817,9 @@
return LinkageInfo::none();
}
- // If we ended up with non-external linkage, visibility should
+ // If we ended up with non-externally-visible linkage, visibility should
// always be default.
- if (LV.getLinkage() != ExternalLinkage)
+ if (!isExternallyVisible(LV.getLinkage()))
return LinkageInfo(LV.getLinkage(), DefaultVisibility, false);
return LV;
diff --git a/clang/test/CodeGenCXX/visibility-inlines-hidden.cpp b/clang/test/CodeGenCXX/visibility-inlines-hidden.cpp
index 6ea2348..20e4a1f 100644
--- a/clang/test/CodeGenCXX/visibility-inlines-hidden.cpp
+++ b/clang/test/CodeGenCXX/visibility-inlines-hidden.cpp
@@ -162,3 +162,16 @@
C::g();
}
}
+
+namespace PR34811 {
+ template <typename T> void tf() {}
+
+ // CHECK-LABEL: define linkonce_odr hidden i8* @_ZN7PR348111fEv(
+ inline void *f() {
+ auto l = []() {};
+ // CHECK-LABEL: define linkonce_odr hidden void @_ZN7PR348112tfIZNS_1fEvEUlvE_EEvv(
+ return (void *)&tf<decltype(l)>;
+ }
+
+ void *p = (void *)f;
+}