r310382 - [Availability] Don't make an availability attribute imply default visibility on macOS

Erik Pilkington via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 8 10:09:09 PDT 2017


Author: epilk
Date: Tue Aug  8 10:09:09 2017
New Revision: 310382

URL: http://llvm.org/viewvc/llvm-project?rev=310382&view=rev
Log:
[Availability] Don't make an availability attribute imply default visibility on macOS

Fixes PR33796, rdar://33655115

Differential revision: https://reviews.llvm.org/D36191

Modified:
    cfe/trunk/docs/ReleaseNotes.rst
    cfe/trunk/lib/AST/Decl.cpp
    cfe/trunk/test/CodeGen/attr-availability.c

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=310382&r1=310381&r2=310382&view=diff
==============================================================================
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Tue Aug  8 10:09:09 2017
@@ -94,6 +94,9 @@ Clang now supports the ...
 Attribute Changes in Clang
 --------------------------
 
+- The presence of __attribute__((availability(...))) on a declaration no longer
+  implies default visibility for that declaration on macOS.
+
 - ...
 
 Windows Support

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=310382&r1=310381&r2=310382&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Tue Aug  8 10:09:09 2017
@@ -216,14 +216,6 @@ static Optional<Visibility> getVisibilit
     return getVisibilityFromAttr(A);
   }
 
-  // If we're on Mac OS X, an 'availability' for Mac OS X attribute
-  // implies visibility(default).
-  if (D->getASTContext().getTargetInfo().getTriple().isOSDarwin()) {
-    for (const auto *A : D->specific_attrs<AvailabilityAttr>())
-      if (A->getPlatform()->getName().equals("macos"))
-        return DefaultVisibility;
-  }
-
   return None;
 }
 

Modified: cfe/trunk/test/CodeGen/attr-availability.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attr-availability.c?rev=310382&r1=310381&r2=310382&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/attr-availability.c (original)
+++ cfe/trunk/test/CodeGen/attr-availability.c Tue Aug  8 10:09:09 2017
@@ -8,9 +8,9 @@
 void f2();
 void f2() { }
 
-// CHECK-10_4-LABEL: define void @f3
-// CHECK-10_5-LABEL: define void @f3
-// CHECK-10_6-LABEL: define void @f3
+// CHECK-10_4-LABEL: define hidden void @f3
+// CHECK-10_5-LABEL: define hidden void @f3
+// CHECK-10_6-LABEL: define hidden void @f3
 void f3() __attribute__((availability(macosx,introduced=10.5)));
 void f3() { }
 




More information about the cfe-commits mailing list