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 | c445d5ddc36cbe5f22baeedaf07ceabaad89a641 (patch) | |
tree | f905ff21d9437c284adcc1e39a264c1fdfafc2a8 | |
parent | 03b7b15f8e879b53148279bcf2dcdda5400d355d (diff) | |
download | bcm5719-llvm-c445d5ddc36cbe5f22baeedaf07ceabaad89a641.tar.gz bcm5719-llvm-c445d5ddc36cbe5f22baeedaf07ceabaad89a641.zip |
R34811: Allow visibilities other than 'default' for VisibleNoLinkage entities.
llvm-svn: 314754
-rw-r--r-- | clang/lib/AST/Decl.cpp | 4 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/visibility-inlines-hidden.cpp | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index df30426ebb6..6e5f638bd55 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/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/clang/test/CodeGenCXX/visibility-inlines-hidden.cpp b/clang/test/CodeGenCXX/visibility-inlines-hidden.cpp index 6ea234807ec..20e4a1f45e3 100644 --- a/clang/test/CodeGenCXX/visibility-inlines-hidden.cpp +++ b/clang/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; +} |