llvm-capstone/clang/test/SemaObjC/class-stub-attr.m
Aaron Ballman 7deaeb2a05 Use functions with prototypes when appropriate; NFC
A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,

  void func();

becomes

  void func(void);

This is the fourth batch of tests being updated (there are a significant
number of other tests left to be updated).
2022-02-07 15:29:36 -05:00

28 lines
1.1 KiB
Objective-C

// RUN: %clang -target x86_64-apple-darwin -fsyntax-only -Xclang -verify %s
// RUN: %clang -target x86_64-apple-darwin -x objective-c++ -fsyntax-only -Xclang -verify %s
@interface NSObject
@end
__attribute__((objc_class_stub))
@interface MissingSubclassingRestrictedAttribute : NSObject // expected-error {{'objc_class_stub' attribute cannot be specified on a class that does not have the 'objc_subclassing_restricted' attribute}}
@end
__attribute__((objc_class_stub))
__attribute__((objc_subclassing_restricted))
@interface ValidClassStubAttribute : NSObject
@end
@implementation ValidClassStubAttribute // expected-error {{cannot declare implementation of a class declared with the 'objc_class_stub' attribute}}
@end
@implementation ValidClassStubAttribute (MyCategory)
@end
__attribute__((objc_class_stub(123))) // expected-error {{'objc_class_stub' attribute takes no arguments}}
@interface InvalidClassStubAttribute : NSObject
@end
__attribute__((objc_class_stub)) // expected-error {{'objc_class_stub' attribute only applies to Objective-C interfaces}}
int cannotHaveObjCClassStubAttribute(void) {}