diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-10-03 01:58:15 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-10-03 01:58:15 +0000 |
commit | 36f680edfdceb721e4b329b268dafef9649b3870 (patch) | |
tree | 3705f89c6be20ce8a3a01c9e24ed678a86ac6811 | |
parent | 6a419e7edff49ad1ca5a4d7a80962c9d8bd1dc70 (diff) |
R34811: Allow visibilities other than 'default' for VisibleNoLinkage entities.linaro-local/diana.picus/NeonSHFailure
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314754 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/Decl.cpp | 4 | ||||
-rw-r--r-- | test/CodeGenCXX/visibility-inlines-hidden.cpp | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index df30426ebb..6e5f638bd5 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -817,9 +817,9 @@ LinkageComputer::getLVForNamespaceScopeDecl(const NamedDecl *D, 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/test/CodeGenCXX/visibility-inlines-hidden.cpp b/test/CodeGenCXX/visibility-inlines-hidden.cpp index 6ea234807e..20e4a1f45e 100644 --- a/test/CodeGenCXX/visibility-inlines-hidden.cpp +++ b/test/CodeGenCXX/visibility-inlines-hidden.cpp @@ -162,3 +162,16 @@ namespace test6 { 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; +} |