]> granicus.if.org Git - clang/commitdiff
R34811: Allow visibilities other than 'default' for VisibleNoLinkage entities.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 3 Oct 2017 01:58:15 +0000 (01:58 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 3 Oct 2017 01:58:15 +0000 (01:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314754 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Decl.cpp
test/CodeGenCXX/visibility-inlines-hidden.cpp

index df30426ebb61e71c1c052d2b8259d7f16df08874..6e5f638bd55e1796ed1dcc9bdb022a6e70a659cd 100644 (file)
@@ -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;
index 6ea234807ec23a6e02a12e786a8475baf97d3cb0..20e4a1f45e3c696c1bfa61a7fcddbe9114bce730 100644 (file)
@@ -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;
+}