xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/attr-root-class.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify -Wattributes -Wobjc-root-class %s
2*f4a2713aSLionel Sambuc@interface RootClass {} // expected-warning {{class 'RootClass' defined without specifying a base class}} \
3*f4a2713aSLionel Sambuc                        // expected-note {{add a super class to fix this problem}}
4*f4a2713aSLionel Sambuc@end
5*f4a2713aSLionel Sambuc@implementation RootClass
6*f4a2713aSLionel Sambuc@end
7*f4a2713aSLionel Sambuc
8*f4a2713aSLionel Sambuc__attribute__((objc_root_class))
9*f4a2713aSLionel Sambuc@interface NonRootClass : RootClass   // expected-error {{objc_root_class attribute may only be specified on a root class declaration}}
10*f4a2713aSLionel Sambuc@end
11*f4a2713aSLionel Sambuc@implementation NonRootClass
12*f4a2713aSLionel Sambuc@end
13*f4a2713aSLionel Sambuc
14*f4a2713aSLionel Sambuc__attribute__((objc_root_class)) static void nonClassDeclaration()  // expected-error {{'objc_root_class' attribute only applies to Objective-C interfaces}}
15*f4a2713aSLionel Sambuc{
16*f4a2713aSLionel Sambuc}
17*f4a2713aSLionel Sambuc
18*f4a2713aSLionel Sambuc__attribute__((objc_root_class(1))) // expected-error {{'objc_root_class' attribute takes no arguments}}
19*f4a2713aSLionel Sambuc@interface I1
20*f4a2713aSLionel Sambuc@end
21