annotate clang/test/SemaObjC/subclassing-restricted-attr.m @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wno-objc-root-class %s
anatofuz
parents:
diff changeset
3 // rdar://16560476
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 __attribute__((objc_subclassing_restricted))
anatofuz
parents:
diff changeset
6 @interface Leaf // okay
anatofuz
parents:
diff changeset
7 @end
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 __attribute__((objc_subclassing_restricted))
anatofuz
parents:
diff changeset
10 @interface SubClassOfLeaf : Leaf // expected-note {{class is declared here}}
anatofuz
parents:
diff changeset
11 @end
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 @interface SubClass : SubClassOfLeaf // expected-error {{cannot subclass a class that was declared with the 'objc_subclassing_restricted' attribute}}
anatofuz
parents:
diff changeset
15 @end
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 __attribute__((objc_root_class))
anatofuz
parents:
diff changeset
18 @interface PlainRoot
anatofuz
parents:
diff changeset
19 @end
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 __attribute__((objc_subclassing_restricted))
anatofuz
parents:
diff changeset
22 @interface Sub2Class : PlainRoot // okay
anatofuz
parents:
diff changeset
23 @end
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 // rdar://28753587
anatofuz
parents:
diff changeset
26 __attribute__((objc_subclassing_restricted))
anatofuz
parents:
diff changeset
27 @interface SuperImplClass // expected-note {{class is declared here}}
anatofuz
parents:
diff changeset
28 @end
anatofuz
parents:
diff changeset
29 @implementation SuperImplClass
anatofuz
parents:
diff changeset
30 @end
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 __attribute__((objc_subclassing_restricted))
anatofuz
parents:
diff changeset
33 @interface SubImplClass : SuperImplClass
anatofuz
parents:
diff changeset
34 @end
anatofuz
parents:
diff changeset
35 @implementation SubImplClass // expected-error {{cannot subclass a class that was declared with the 'objc_subclassing_restricted' attribute}}
anatofuz
parents:
diff changeset
36 @end