[PATCH] D36191: [CodeGen] Don't make availability attributes imply default visibility on macos

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 1 14:21:08 PDT 2017


erik.pilkington created this revision.

Previously, the presence of `__attribute__((availability(macos, ...)))` on a declaration caused clang to make the vis of that decl implicitly default. This is a hack that is incomparable with how we're treating availability attributes now, and should be removed.

Thanks for taking a look!
Erik


https://reviews.llvm.org/D36191

Files:
  lib/AST/Decl.cpp
  test/CodeGen/attr-availability.c


Index: test/CodeGen/attr-availability.c
===================================================================
--- test/CodeGen/attr-availability.c
+++ test/CodeGen/attr-availability.c
@@ -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() { }
 
Index: lib/AST/Decl.cpp
===================================================================
--- lib/AST/Decl.cpp
+++ lib/AST/Decl.cpp
@@ -216,14 +216,6 @@
     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;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36191.109218.patch
Type: text/x-patch
Size: 1117 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170801/1462b539/attachment.bin>


More information about the cfe-commits mailing list