1// RUN: %clang -target x86_64-apple-darwin -fsyntax-only -Xclang -verify %s
2// RUN: %clang -target x86_64-apple-darwin -x objective-c++ -fsyntax-only -Xclang -verify %s
3
4@interface NSObject
5@end
6
7__attribute__((objc_class_stub))
8@interface MissingSubclassingRestrictedAttribute : NSObject // expected-error {{'objc_class_stub' attribute cannot be specified on a class that does not have the 'objc_subclassing_restricted' attribute}}
9@end
10
11__attribute__((objc_class_stub))
12__attribute__((objc_subclassing_restricted))
13@interface ValidClassStubAttribute : NSObject
14@end
15
16@implementation ValidClassStubAttribute // expected-error {{cannot declare implementation of a class declared with the 'objc_class_stub' attribute}}
17@end
18
19@implementation ValidClassStubAttribute (MyCategory)
20@end
21
22__attribute__((objc_class_stub(123))) // expected-error {{'objc_class_stub' attribute takes no arguments}}
23@interface InvalidClassStubAttribute : NSObject
24@end
25
26__attribute__((objc_class_stub)) // expected-error {{'objc_class_stub' attribute only applies to Objective-C interfaces}}
27int cannotHaveObjCClassStubAttribute() {}
28