Skip to content

Commit

Permalink
[Availability] Don't make an availability attribute imply default vis…
Browse files Browse the repository at this point in the history
…ibility on macOS

Fixes PR33796, rdar://33655115

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310382 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
epilk committed Aug 8, 2017
1 parent 1bc8e95 commit ef7226a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
3 changes: 3 additions & 0 deletions docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,6 @@ static Optional<Visibility> getVisibilityOf(const NamedDecl *D,
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;
}

Expand Down
6 changes: 3 additions & 3 deletions test/CodeGen/attr-availability.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() { }

Expand Down

0 comments on commit ef7226a

Please sign in to comment.