r314754 - R34811: Allow visibilities other than 'default' for VisibleNoLinkage entities.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 2 18:58:15 PDT 2017


Author: rsmith
Date: Mon Oct  2 18:58:15 2017
New Revision: 314754

URL: http://llvm.org/viewvc/llvm-project?rev=314754&view=rev
Log:
R34811: Allow visibilities other than 'default' for VisibleNoLinkage entities.

Modified:
    cfe/trunk/lib/AST/Decl.cpp
    cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=314754&r1=314753&r2=314754&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Mon Oct  2 18:58:15 2017
@@ -817,9 +817,9 @@ LinkageComputer::getLVForNamespaceScopeD
     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;

Modified: cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp?rev=314754&r1=314753&r2=314754&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility-inlines-hidden.cpp Mon Oct  2 18:58:15 2017
@@ -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;
+}




More information about the cfe-commits mailing list