annotate clang/test/Parser/objc-cxx-keyword-identifiers.mm @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
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 -std=c++11 -Wno-objc-root-class -Wno-incomplete-implementation -triple x86_64-apple-macosx10.10.0 -verify %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 // rdar://20626062
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 struct S {
anatofuz
parents:
diff changeset
6 int throw; // expected-error {{expected member name or ';' after declaration specifiers; 'throw' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
7 };
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 @interface class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
10 @end
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 @interface Bar: class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
13 @end
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 @protocol P // ok
anatofuz
parents:
diff changeset
16 @end
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 @protocol new // expected-error {{expected identifier; 'new' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
19 @end
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 @protocol P2;
anatofuz
parents:
diff changeset
22 @protocol delete // expected-error {{expected identifier; 'delete' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
23 @end
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 @class Foo, try; // expected-error {{expected identifier; 'try' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 @interface Foo
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 @property (readwrite, nonatomic) int a, b, throw; // expected-error {{expected member name or ';' after declaration specifiers; 'throw' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 -foo:(int)class; // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
32 +foo:(int)constexpr; // expected-error {{expected identifier; 'constexpr' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 @end
anatofuz
parents:
diff changeset
35
anatofuz
parents:
diff changeset
36 @interface Foo () <P, new> // expected-error {{expected identifier; 'new' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
37 @end
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 @implementation Foo
anatofuz
parents:
diff changeset
40
anatofuz
parents:
diff changeset
41 @synthesize a = _a; // ok
anatofuz
parents:
diff changeset
42 @synthesize b = virtual; // expected-error {{expected identifier; 'virtual' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
43
anatofuz
parents:
diff changeset
44 @dynamic throw; // expected-error {{expected identifier; 'throw' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
45
anatofuz
parents:
diff changeset
46 -foo:(int)class { // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
47 }
anatofuz
parents:
diff changeset
48
anatofuz
parents:
diff changeset
49 @end
anatofuz
parents:
diff changeset
50
anatofuz
parents:
diff changeset
51 @implementation class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
52 @end
anatofuz
parents:
diff changeset
53
anatofuz
parents:
diff changeset
54 @implementation Bar: class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
55 @end
anatofuz
parents:
diff changeset
56
anatofuz
parents:
diff changeset
57 @compatibility_alias C Foo; // ok
anatofuz
parents:
diff changeset
58 @compatibility_alias const_cast Bar; // expected-error {{expected identifier; 'const_cast' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
59 @compatibility_alias C2 class; // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
60
anatofuz
parents:
diff changeset
61 void func() {
anatofuz
parents:
diff changeset
62 (void)@protocol(P); // ok
anatofuz
parents:
diff changeset
63 (void)@protocol(delete); // expected-error {{expected identifier; 'delete' is a keyword in Objective-C++}}
anatofuz
parents:
diff changeset
64 }