[PATCH] D25993: [Objective-C] Add objc_subclassing_restricted attribute

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 26 08:25:00 PDT 2016


arphaman created this revision.
arphaman added reviewers: aaron.ballman, jordan_rose.
arphaman added a subscriber: cfe-commits.
arphaman set the repository for this revision to rL LLVM.

This patch adds an `objc_subclassing_restricted` attribute into clang. This attribute acts similarly to 'final' - Objective-C classes with this attribute can't be subclassed. However, `@interface` declarations that have `objc_subclassing_restricted` but don't have `@implementation` are allowed to inherit other `@interface` declarations with `objc_subclassing_restricted`. This is needed to describe the Swift class hierarchy in clang while making sure that the Objective-C classes can't subclass the Swift classes.

This attribute is already implemented in a fork of clang that's used for Swift (https://github.com/apple/swift-clang) and this patch migrates that code to the upstream clang repository.


Repository:
  rL LLVM

https://reviews.llvm.org/D25993

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaDeclObjC.cpp
  test/SemaObjC/subclassing-restricted-attr.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25993.75898.patch
Type: text/x-patch
Size: 4871 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161026/2d830e37/attachment.bin>


More information about the cfe-commits mailing list