diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2012-04-14 14:01:31 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2012-04-14 14:01:31 +0000 |
commit | dbe13110f59f48b4dbb7552b3ac2935acdeece7f (patch) | |
tree | be1815eb79b42ff482a8562b13c2dcbf0c5dcbee /test/Index/annotate-literals.m | |
parent | 9da628931ebf2609493570f87824ca22402cc65f (diff) | |
download | src-dbe13110f59f48b4dbb7552b3ac2935acdeece7f.tar.gz src-dbe13110f59f48b4dbb7552b3ac2935acdeece7f.zip |
Vendor import of clang trunk r154661:vendor/clang/clang-trunk-r154661
Notes
Notes:
svn path=/vendor/clang/dist/; revision=234287
svn path=/vendor/clang/clang-trunk-r154661/; revision=234288; tag=vendor/clang/clang-trunk-r154661
Diffstat (limited to 'test/Index/annotate-literals.m')
-rw-r--r-- | test/Index/annotate-literals.m | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/test/Index/annotate-literals.m b/test/Index/annotate-literals.m new file mode 100644 index 000000000000..20bfd2c45642 --- /dev/null +++ b/test/Index/annotate-literals.m @@ -0,0 +1,72 @@ +typedef unsigned char BOOL; + +@interface NSNumber @end + +@interface NSNumber (NSNumberCreation) ++ (NSNumber *)numberWithChar:(char)value; ++ (NSNumber *)numberWithUnsignedChar:(unsigned char)value; ++ (NSNumber *)numberWithShort:(short)value; ++ (NSNumber *)numberWithUnsignedShort:(unsigned short)value; ++ (NSNumber *)numberWithInt:(int)value; ++ (NSNumber *)numberWithUnsignedInt:(unsigned int)value; ++ (NSNumber *)numberWithLong:(long)value; ++ (NSNumber *)numberWithUnsignedLong:(unsigned long)value; ++ (NSNumber *)numberWithLongLong:(long long)value; ++ (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value; ++ (NSNumber *)numberWithFloat:(float)value; ++ (NSNumber *)numberWithDouble:(double)value; ++ (NSNumber *)numberWithBool:(BOOL)value; +@end + +@interface NSArray +@end + +@interface NSArray (NSArrayCreation) ++ (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt; +@end + +@interface NSDictionary ++ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt; +@end + +void test_literals(id k1, id o1, id k2, id o2, id k3) { + id objects = @[ o1, o2 ]; + id dict = @{ k1 : o1, + k2 : o2, + k3 : @17 }; +} + + +// RUN: c-index-test -test-annotate-tokens=%s:33:1:37:1 %s | FileCheck -check-prefix=CHECK-LITERALS %s + +// CHECK-LITERALS: Identifier: "id" [33:3 - 33:5] TypeRef=id:0:0 +// CHECK-LITERALS: Identifier: "objects" [33:6 - 33:13] VarDecl=objects:33:6 (Definition) +// CHECK-LITERALS: Punctuation: "=" [33:14 - 33:15] VarDecl=objects:33:6 (Definition) +// CHECK-LITERALS: Punctuation: "@" [33:16 - 33:17] UnexposedExpr= +// CHECK-LITERALS: Punctuation: "[" [33:17 - 33:18] UnexposedExpr= +// CHECK-LITERALS: Identifier: "o1" [33:19 - 33:21] DeclRefExpr=o1:32:30 +// CHECK-LITERALS: Punctuation: "," [33:21 - 33:22] UnexposedExpr= +// CHECK-LITERALS: Identifier: "o2" [33:23 - 33:25] DeclRefExpr=o2:32:44 +// CHECK-LITERALS: Punctuation: "]" [33:26 - 33:27] UnexposedExpr= +// CHECK-LITERALS: Punctuation: ";" [33:27 - 33:28] DeclStmt= +// CHECK-LITERALS: Identifier: "id" [34:3 - 34:5] TypeRef=id:0:0 +// CHECK-LITERALS: Identifier: "dict" [34:6 - 34:10] VarDecl=dict:34:6 (Definition) +// CHECK-LITERALS: Punctuation: "=" [34:11 - 34:12] VarDecl=dict:34:6 (Definition) +// CHECK-LITERALS: Punctuation: "@" [34:13 - 34:14] UnexposedExpr= +// CHECK-LITERALS: Punctuation: "{" [34:14 - 34:15] UnexposedExpr= +// CHECK-LITERALS: Identifier: "k1" [34:16 - 34:18] DeclRefExpr=k1:32:23 +// CHECK-LITERALS: Punctuation: ":" [34:19 - 34:20] UnexposedExpr= +// CHECK-LITERALS: Identifier: "o1" [34:21 - 34:23] DeclRefExpr=o1:32:30 +// CHECK-LITERALS: Punctuation: "," [34:23 - 34:24] UnexposedExpr= +// CHECK-LITERALS: Identifier: "k2" [35:16 - 35:18] DeclRefExpr=k2:32:37 +// CHECK-LITERALS: Punctuation: ":" [35:19 - 35:20] UnexposedExpr= +// CHECK-LITERALS: Identifier: "o2" [35:21 - 35:23] DeclRefExpr=o2:32:44 +// CHECK-LITERALS: Punctuation: "," [35:23 - 35:24] UnexposedExpr= +// CHECK-LITERALS: Identifier: "k3" [36:16 - 36:18] DeclRefExpr=k3:32:51 +// CHECK-LITERALS: Punctuation: ":" [36:19 - 36:20] UnexposedExpr= +// CHECK-LITERALS: Punctuation: "@" [36:21 - 36:22] UnexposedExpr= +// CHECK-LITERALS: Literal: "17" [36:22 - 36:24] IntegerLiteral= +// CHECK-LITERALS: Punctuation: "}" [36:25 - 36:26] UnexposedExpr= +// CHECK-LITERALS: Punctuation: ";" [36:26 - 36:27] DeclStmt= +// CHECK-LITERALS: Punctuation: "}" [37:1 - 37:2] CompoundStmt= + |