diff options
Diffstat (limited to 'test/Index')
107 files changed, 3928 insertions, 314 deletions
diff --git a/test/Index/Inputs/Frameworks/Framework.framework/Headers/Framework.h b/test/Index/Inputs/Frameworks/Framework.framework/Headers/Framework.h new file mode 100644 index 000000000000..3e3830a2ba44 --- /dev/null +++ b/test/Index/Inputs/Frameworks/Framework.framework/Headers/Framework.h @@ -0,0 +1,2 @@ +int *getFrameworkVersion(); + diff --git a/test/Index/Inputs/Headers/a.h b/test/Index/Inputs/Headers/a.h new file mode 100644 index 000000000000..33c341767627 --- /dev/null +++ b/test/Index/Inputs/Headers/a.h @@ -0,0 +1,2 @@ +int *getA(); + diff --git a/test/Index/Inputs/Headers/a_extensions.h b/test/Index/Inputs/Headers/a_extensions.h new file mode 100644 index 000000000000..215578754924 --- /dev/null +++ b/test/Index/Inputs/Headers/a_extensions.h @@ -0,0 +1 @@ +int *getAExtensions(); diff --git a/test/Index/Inputs/Headers/crash.h b/test/Index/Inputs/Headers/crash.h new file mode 100644 index 000000000000..238359abbe33 --- /dev/null +++ b/test/Index/Inputs/Headers/crash.h @@ -0,0 +1,6 @@ +// Produce a crash if CRASH is defined. +#ifdef CRASH +# pragma clang __debug crash +#endif + +const char *getCrashString(); diff --git a/test/Index/Inputs/Headers/module.map b/test/Index/Inputs/Headers/module.map new file mode 100644 index 000000000000..55f8eb7eaa24 --- /dev/null +++ b/test/Index/Inputs/Headers/module.map @@ -0,0 +1,10 @@ +module LibA { + header "a.h" + module Extensions { + header "a_extensions.h" + } +} + +module Crash { + header "crash.h" +} diff --git a/test/Index/Inputs/Headers/nested/module.map b/test/Index/Inputs/Headers/nested/module.map new file mode 100644 index 000000000000..bd239f1fc1d1 --- /dev/null +++ b/test/Index/Inputs/Headers/nested/module.map @@ -0,0 +1,4 @@ +module nested { + header "nested.h" +} + diff --git a/test/Index/Inputs/Headers/nested/nested.h b/test/Index/Inputs/Headers/nested/nested.h new file mode 100644 index 000000000000..01716d12ec1d --- /dev/null +++ b/test/Index/Inputs/Headers/nested/nested.h @@ -0,0 +1 @@ +int *getNested(); diff --git a/test/Index/Inputs/pragma_disable_warning.h b/test/Index/Inputs/pragma_disable_warning.h new file mode 100644 index 000000000000..b40e9e7f97fc --- /dev/null +++ b/test/Index/Inputs/pragma_disable_warning.h @@ -0,0 +1 @@ +#pragma clang diagnostic ignored "-Wunused-parameter" diff --git a/test/Index/Inputs/redeclarations.h b/test/Index/Inputs/redeclarations.h new file mode 100644 index 000000000000..7f0d7aebb862 --- /dev/null +++ b/test/Index/Inputs/redeclarations.h @@ -0,0 +1,21 @@ +class X +{ + friend class A; +}; + + +template <typename T1, typename T2> +class B +{ +}; + +template <class T> +struct C +{ +}; + +class D +{ + B<D, class A> x; + friend struct C<A>; +}; diff --git a/test/Index/Inputs/reparse-instantiate.h b/test/Index/Inputs/reparse-instantiate.h new file mode 100644 index 000000000000..df90a6dd4823 --- /dev/null +++ b/test/Index/Inputs/reparse-instantiate.h @@ -0,0 +1,14 @@ +template <typename T> struct S; + +template<typename T> void c(T) +{ +} + +template <> struct S <int> +{ + void a() + { + c(&S<int>::b); + } + void b() {} +}; diff --git a/test/Index/TestClassDecl.m b/test/Index/TestClassDecl.m index e94a5c12fa39..038353b11dd6 100644 --- a/test/Index/TestClassDecl.m +++ b/test/Index/TestClassDecl.m @@ -16,7 +16,7 @@ void function(Foo * arg) } // CHECK-scan: [1:1 - 8:1] Invalid Cursor => NoDeclFound -// CHECK-scan: [8:1 - 8:8] UnexposedDecl=[10:12] +// CHECK-scan: [8:1 - 8:8] ObjCInterfaceDecl=Foo:8:8 // CHECK-scan: [8:8 - 8:11] ObjCClassRef=Foo:10:12 // CHECK-scan: [8:11 - 10:1] Invalid Cursor => NoDeclFound // CHECK-scan: [10:1 - 11:5] ObjCInterfaceDecl=Foo:10:12 diff --git a/test/Index/TestClassForwardDecl.m b/test/Index/TestClassForwardDecl.m index d3d720c2bafa..2f32d33c7082 100644 --- a/test/Index/TestClassForwardDecl.m +++ b/test/Index/TestClassForwardDecl.m @@ -13,7 +13,7 @@ void function(Foo * arg) } // CHECK-scan: [1:1 - 8:1] Invalid Cursor => NoDeclFound -// CHECK-scan: [8:1 - 8:8] UnexposedDecl=[8:8] +// CHECK-scan: [8:1 - 8:8] ObjCInterfaceDecl=Foo:8:8 // CHECK-scan: [8:8 - 8:11] ObjCClassRef=Foo:8:8 // CHECK-scan: [8:11 - 10:1] Invalid Cursor => NoDeclFound // CHECK-scan: [10:1 - 10:15] FunctionDecl=function:10:6 (Definition) diff --git a/test/Index/annotate-attribute.cpp b/test/Index/annotate-attribute.cpp index 6721371ca754..d822210e493e 100644 --- a/test/Index/annotate-attribute.cpp +++ b/test/Index/annotate-attribute.cpp @@ -17,17 +17,17 @@ protected: }; // CHECK: ClassDecl=Test:3:7 (Definition) Extent=[3:1 - 17:2] -// CHECK: CXXAccessSpecifier=:4:1 (Definition) Extent=[4:1 - 4:8] -// CHECK: CXXMethod=aMethod:5:51 Extent=[5:3 - 5:60] -// CHECK: attribute(annotate)=spiffy_method Extent=[5:18 - 5:43] -// CHECK: CXXAccessSpecifier=:7:1 (Definition) Extent=[7:1 - 7:43] -// CHECK: attribute(annotate)=works Extent=[7:23 - 7:40] -// CHECK: CXXMethod=anotherMethod:8:8 Extent=[8:3 - 8:23] -// CHECK: attribute(annotate)=works Extent=[7:23 - 7:40] -// CHECK: CXXAccessSpecifier=:10:1 (Definition) Extent=[10:1 - 10:53] -// CHECK: attribute(annotate)=investigations Extent=[10:24 - 10:50] -// CHECK: CXXMethod=inlineMethod:12:8 (Definition) Extent=[12:3 - 12:25] -// CHECK: attribute(annotate)=investigations Extent=[10:24 - 10:50] -// CHECK: CompoundStmt= Extent=[12:23 - 12:25] -// CHECK: CXXAccessSpecifier=:14:1 (Definition) Extent=[14:1 - 14:11] -// CHECK: CXXMethod=methodWithoutAttribute:16:8 Extent=[16:3 - 16:32] +// CHECK-NEXT: CXXAccessSpecifier=:4:1 (Definition) Extent=[4:1 - 4:8] +// CHECK-NEXT: CXXMethod=aMethod:5:51 Extent=[5:3 - 5:60] +// CHECK-NEXT: attribute(annotate)=spiffy_method Extent=[5:18 - 5:43] +// CHECK-NEXT: CXXAccessSpecifier=:7:1 (Definition) Extent=[7:1 - 7:43] +// CHECK-NEXT: attribute(annotate)=works Extent=[7:23 - 7:40] +// CHECK-NEXT: CXXMethod=anotherMethod:8:8 Extent=[8:3 - 8:23] +// CHECK-NEXT: attribute(annotate)=works Extent=[7:23 - 7:40] +// CHECK-NEXT: CXXAccessSpecifier=:10:1 (Definition) Extent=[10:1 - 10:53] +// CHECK-NEXT: attribute(annotate)=investigations Extent=[10:24 - 10:50] +// CHECK-NEXT: CXXMethod=inlineMethod:12:8 (Definition) Extent=[12:3 - 12:25] +// CHECK-NEXT: attribute(annotate)=investigations Extent=[10:24 - 10:50] +// CHECK-NEXT: CompoundStmt= Extent=[12:23 - 12:25] +// CHECK-NEXT: CXXAccessSpecifier=:14:1 (Definition) Extent=[14:1 - 14:11] +// CHECK-NEXT: CXXMethod=methodWithoutAttribute:16:8 Extent=[16:3 - 16:32] 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= + diff --git a/test/Index/annotate-macro-args.m b/test/Index/annotate-macro-args.m index 6adfb8ded1c5..b92c0b29eb67 100644 --- a/test/Index/annotate-macro-args.m +++ b/test/Index/annotate-macro-args.m @@ -9,15 +9,15 @@ // CHECK1: Identifier: "MACRO" [9:3 - 9:8] macro expansion=MACRO:6:9 // CHECK1: Punctuation: "(" [9:8 - 9:9] -// CHECK1: Punctuation: "[" [9:9 - 9:10] ObjCMessageExpr=meth:2:1 +// CHECK1: Punctuation: "[" [9:9 - 9:10] ObjCMessageExpr=meth:2:8 // CHECK1: Identifier: "MyClass" [9:10 - 9:17] ObjCClassRef=MyClass:1:12 -// CHECK1: Identifier: "meth" [9:18 - 9:22] ObjCMessageExpr=meth:2:1 -// CHECK1: Punctuation: "]" [9:22 - 9:23] ObjCMessageExpr=meth:2:1 +// CHECK1: Identifier: "meth" [9:18 - 9:22] ObjCMessageExpr=meth:2:8 +// CHECK1: Punctuation: "]" [9:22 - 9:23] ObjCMessageExpr=meth:2:8 // CHECK1: Punctuation: ")" [9:23 - 9:24] // CHECK2: Identifier: "INVOKE" [15:3 - 15:9] macro expansion=INVOKE:12:9 // CHECK2: Punctuation: "(" [15:9 - 15:10] -// CHECK2: Identifier: "meth" [15:10 - 15:14] ObjCMessageExpr=meth:2:1 +// CHECK2: Identifier: "meth" [15:10 - 15:14] ObjCMessageExpr=meth:2:8 // CHECK2: Punctuation: "," [15:14 - 15:15] // CHECK2: Identifier: "MyClass" [15:16 - 15:23] ObjCClassRef=MyClass:1:12 // CHECK2: Punctuation: ")" [15:23 - 15:24] diff --git a/test/Index/annotate-subscripting.m b/test/Index/annotate-subscripting.m new file mode 100644 index 000000000000..cda1465c371b --- /dev/null +++ b/test/Index/annotate-subscripting.m @@ -0,0 +1,92 @@ +@interface NSArray +- (id)objectAtIndexedSubscript:(int)index; ++ (id)arrayWithObjects:(id *)objects count:(unsigned)count; +@end + +@interface NSMutableArray : NSArray +- (id)objectAtIndexedSubscript:(int)index; +- (void)setObject:(id)object atIndexedSubscript:(int)index; +@end + +@interface NSDictionary +- (id)objectForKeyedSubscript:(id)key; ++ (id)dictionaryWithObjects:(id *)objects forKeys:(id *)keys count:(unsigned)count; +@end + +@interface NSMutableDictionary : NSDictionary +- (void)setObject:(id)object forKeyedSubscript:(id)key; +@end + +@class NSString; + +id testArray(int index, id p) { + NSMutableArray *array; + array[3] = 0; + NSArray *arr = @[ p, p ]; + return array[index]; +} + +void testDict() { + NSMutableDictionary *dictionary; + NSString *key; + id newObject, oldObject; + oldObject = dictionary[key]; + dictionary[key] = newObject; + NSDictionary *dict = @{ key: newObject, key: oldObject }; +} + +// RUN: c-index-test -test-annotate-tokens=%s:22:1:36:1 -target x86_64-apple-macosx10.7 %s | FileCheck %s +// CHECK: Identifier: "array" [24:3 - 24:8] DeclRefExpr=array:23:19 +// CHECK: Punctuation: "[" [24:8 - 24:9] UnexposedExpr= +// CHECK: Literal: "3" [24:9 - 24:10] IntegerLiteral= +// CHECK: Punctuation: "]" [24:10 - 24:11] UnexposedExpr= +// CHECK: Punctuation: "=" [24:12 - 24:13] BinaryOperator= +// CHECK: Literal: "0" [24:14 - 24:15] IntegerLiteral= +// CHECK: Punctuation: ";" [24:15 - 24:16] CompoundStmt= +// CHECK: Identifier: "NSArray" [25:3 - 25:10] ObjCClassRef=NSArray:1:12 +// CHECK: Punctuation: "*" [25:11 - 25:12] VarDecl=arr:25:12 (Definition) +// CHECK: Identifier: "arr" [25:12 - 25:15] VarDecl=arr:25:12 (Definition) +// CHECK: Punctuation: "=" [25:16 - 25:17] VarDecl=arr:25:12 (Definition) +// CHECK: Punctuation: "@" [25:18 - 25:19] UnexposedExpr= +// CHECK: Punctuation: "[" [25:19 - 25:20] UnexposedExpr= +// CHECK: Identifier: "p" [25:21 - 25:22] DeclRefExpr=p:22:28 +// CHECK: Punctuation: "," [25:22 - 25:23] UnexposedExpr= +// CHECK: Identifier: "p" [25:24 - 25:25] DeclRefExpr=p:22:28 +// CHECK: Punctuation: "]" [25:26 - 25:27] UnexposedExpr= +// CHECK: Punctuation: ";" [25:27 - 25:28] DeclStmt= +// CHECK: Keyword: "return" [26:3 - 26:9] ReturnStmt= +// CHECK: Identifier: "array" [26:10 - 26:15] DeclRefExpr=array:23:19 +// CHECK: Punctuation: "[" [26:15 - 26:16] UnexposedExpr= +// CHECK: Identifier: "index" [26:16 - 26:21] DeclRefExpr=index:22:18 +// CHECK: Punctuation: "]" [26:21 - 26:22] UnexposedExpr= +// CHECK: Punctuation: ";" [26:22 - 26:23] CompoundStmt= + +// CHECK: Identifier: "oldObject" [33:3 - 33:12] DeclRefExpr=oldObject:32:17 +// CHECK: Punctuation: "=" [33:13 - 33:14] BinaryOperator= +// CHECK: Identifier: "dictionary" [33:15 - 33:25] DeclRefExpr=dictionary:30:24 +// CHECK: Punctuation: "[" [33:25 - 33:26] UnexposedExpr= +// CHECK: Identifier: "key" [33:26 - 33:29] DeclRefExpr=key:31:13 +// CHECK: Punctuation: "]" [33:29 - 33:30] UnexposedExpr= +// CHECK: Punctuation: ";" [33:30 - 33:31] CompoundStmt= +// CHECK: Identifier: "dictionary" [34:3 - 34:13] DeclRefExpr=dictionary:30:24 +// CHECK: Punctuation: "[" [34:13 - 34:14] UnexposedExpr= +// CHECK: Identifier: "key" [34:14 - 34:17] DeclRefExpr=key:31:13 +// CHECK: Punctuation: "]" [34:17 - 34:18] UnexposedExpr= +// CHECK: Punctuation: "=" [34:19 - 34:20] BinaryOperator= +// CHECK: Identifier: "newObject" [34:21 - 34:30] DeclRefExpr=newObject:32:6 +// CHECK: Punctuation: ";" [34:30 - 34:31] CompoundStmt= +// CHECK: Identifier: "NSDictionary" [35:3 - 35:15] ObjCClassRef=NSDictionary:11:12 +// CHECK: Punctuation: "*" [35:16 - 35:17] VarDecl=dict:35:17 (Definition) +// CHECK: Identifier: "dict" [35:17 - 35:21] VarDecl=dict:35:17 (Definition) +// CHECK: Punctuation: "=" [35:22 - 35:23] VarDecl=dict:35:17 (Definition) +// CHECK: Punctuation: "@" [35:24 - 35:25] UnexposedExpr= +// CHECK: Punctuation: "{" [35:25 - 35:26] UnexposedExpr= +// CHECK: Identifier: "key" [35:27 - 35:30] DeclRefExpr=key:31:13 +// CHECK: Punctuation: ":" [35:30 - 35:31] UnexposedExpr= +// CHECK: Identifier: "newObject" [35:32 - 35:41] DeclRefExpr=newObject:32:6 +// CHECK: Punctuation: "," [35:41 - 35:42] UnexposedExpr= +// CHECK: Identifier: "key" [35:43 - 35:46] DeclRefExpr=key:31:13 +// CHECK: Punctuation: ":" [35:46 - 35:47] UnexposedExpr= +// CHECK: Identifier: "oldObject" [35:48 - 35:57] DeclRefExpr=oldObject:32:17 +// CHECK: Punctuation: "}" [35:58 - 35:59] UnexposedExpr= +// CHECK: Punctuation: ";" [35:59 - 35:60] DeclStmt= diff --git a/test/Index/annotate-tokens-cxx0x.cpp b/test/Index/annotate-tokens-cxx0x.cpp index 89876b28eab3..a126b8512775 100644 --- a/test/Index/annotate-tokens-cxx0x.cpp +++ b/test/Index/annotate-tokens-cxx0x.cpp @@ -6,6 +6,11 @@ int f(Args ...args) { void test() { int a; decltype(a) b; + + typedef int Integer; + typedef float Float; + typedef bool Bool; + bool b2 = __is_trivially_constructible(Integer, Float, Bool); } // RUN: c-index-test -test-annotate-tokens=%s:1:1:5:1 -fno-delayed-template-parsing -std=c++11 %s | FileCheck %s @@ -14,3 +19,9 @@ void test() { // RUN: c-index-test -test-annotate-tokens=%s:8:1:9:1 -std=c++11 %s | FileCheck -check-prefix=CHECK-DECLTYPE %s // CHECK-DECLTYPE: Identifier: "a" [8:12 - 8:13] DeclRefExpr=a:7:7 + +// RUN: c-index-test -test-annotate-tokens=%s:13:1:14:1 -std=c++11 %s | FileCheck -check-prefix=CHECK-TRAIT %s +// CHECK-TRAIT: Identifier: "Integer" [13:42 - 13:49] TypeRef=Integer:10:15 +// CHECK-TRAIT: Identifier: "Float" [13:51 - 13:56] TypeRef=Float:11:17 +// CHECK-TRAIT: Identifier: "Bool" [13:58 - 13:62] TypeRef=Bool:12:16 + diff --git a/test/Index/annotate-tokens-pp.c b/test/Index/annotate-tokens-pp.c index 45988270f0e6..b37ab39eeaff 100644 --- a/test/Index/annotate-tokens-pp.c +++ b/test/Index/annotate-tokens-pp.c @@ -124,7 +124,7 @@ const char *fname = __FILE__; // CHECK: Punctuation: "," [16:26 - 16:27] // CHECK: Identifier: "z" [16:27 - 16:28] DeclRefExpr=z:14:7 // FIXME: The token below should really be annotated as "macro expansion=REVERSE_MACRO:10:9" -// CHECK: Punctuation: ")" [16:28 - 16:29] VarDecl=k:16:7 (Definition) +// CHECK: Punctuation: ")" [16:28 - 16:29] DeclStmt= // CHECK: Punctuation: ";" [16:29 - 16:30] DeclStmt= // CHECK: Keyword: "int" [17:3 - 17:6] VarDecl=j:17:7 (Definition) // CHECK: Identifier: "j" [17:7 - 17:8] VarDecl=j:17:7 (Definition) @@ -135,7 +135,7 @@ const char *fname = __FILE__; // CHECK: Punctuation: "+" [17:25 - 17:26] BinaryOperator= // CHECK: Identifier: "k" [17:27 - 17:28] DeclRefExpr=k:16:7 // FIXME: The token below should really be annotated as "macro expansion=TWICE_MACRO:11:9" -// CHECK: Punctuation: ")" [17:28 - 17:29] VarDecl=j:17:7 (Definition) +// CHECK: Punctuation: ")" [17:28 - 17:29] DeclStmt= // CHECK: Punctuation: ";" [17:29 - 17:30] DeclStmt= // CHECK: Keyword: "int" [18:3 - 18:6] VarDecl=w:18:7 (Definition) // CHECK: Identifier: "w" [18:7 - 18:8] VarDecl=w:18:7 (Definition) @@ -189,7 +189,8 @@ const char *fname = __FILE__; // CHECK: Identifier: "z" [25:43 - 25:44] DeclRefExpr=z:25:3 // CHECK: Punctuation: ";" [25:44 - 25:45] CompoundStmt= // CHECK: Punctuation: "}" [25:46 - 25:47] CompoundStmt= -// CHECK: Punctuation: ")" [25:47 - 25:48] DoStmt= +// FIXME: The token below should really be annotated as "macro expansion=fun_with_macro_bodies:21:9" +// CHECK: Punctuation: ")" [25:47 - 25:48] CompoundStmt= // CHECK: Punctuation: ";" [25:48 - 25:49] CompoundStmt= // CHECK: Punctuation: "}" [26:1 - 26:2] CompoundStmt= // CHECK: {{28:1.*inclusion directive=pragma-once.h.*multi-include guarded}} diff --git a/test/Index/annotate-tokens.cpp b/test/Index/annotate-tokens.cpp index 5a8f5e201d0f..3062901b7c2f 100644 --- a/test/Index/annotate-tokens.cpp +++ b/test/Index/annotate-tokens.cpp @@ -34,7 +34,7 @@ void test3(S2 s2) { // CHECK: Punctuation: ")" [2:17 - 2:18] FunctionDecl=test:2:6 (Definition) // CHECK: Punctuation: "{" [2:19 - 2:20] CompoundStmt= // CHECK: Identifier: "X" [3:5 - 3:6] DeclRefExpr=X:2:16 -// CHECK: Punctuation: "=" [3:7 - 3:8] CallExpr=operator=:1:8 +// CHECK: Punctuation: "=" [3:7 - 3:8] DeclRefExpr=operator=:1:8 // CHECK: Identifier: "X" [3:9 - 3:10] DeclRefExpr=X:2:16 // CHECK: Punctuation: ";" [3:10 - 3:11] CompoundStmt= // CHECK: Keyword: "__is_base_of" [4:5 - 4:17] UnexposedExpr= @@ -78,7 +78,7 @@ void test3(S2 s2) { // CHECK: Punctuation: "(" [13:3 - 13:4] ParenExpr= // CHECK: Identifier: "x" [13:4 - 13:5] DeclRefExpr=x:11:14 // CHECK: Punctuation: ")" [13:5 - 13:6] ParenExpr= -// CHECK: Punctuation: "++" [13:6 - 13:8] CallExpr=operator++:9:5 +// CHECK: Punctuation: "++" [13:6 - 13:8] DeclRefExpr=operator++:9:5 // CHECK: Punctuation: ";" [13:8 - 13:9] CompoundStmt= // CHECK: Punctuation: "}" [14:1 - 14:2] CompoundStmt= // CHECK: Keyword: "struct" [16:1 - 16:7] StructDecl=S1:16:8 (Definition) @@ -111,7 +111,7 @@ void test3(S2 s2) { // CHECK: Punctuation: ")" [18:17 - 18:18] FunctionDecl=test3:18:6 (Definition) // CHECK: Punctuation: "{" [18:19 - 18:20] CompoundStmt= // CHECK: Identifier: "s2" [19:3 - 19:5] DeclRefExpr=s2:18:15 -// CHECK: Punctuation: "->" [19:5 - 19:7] MemberRefExpr=f:16:18 +// CHECK: Punctuation: "->" [19:5 - 19:7] DeclRefExpr=operator->:17:17 // CHECK: Identifier: "f" [19:7 - 19:8] MemberRefExpr=f:16:18 // CHECK: Punctuation: "(" [19:8 - 19:9] CallExpr=f:16:18 // CHECK: Punctuation: ")" [19:9 - 19:10] CallExpr=f:16:18 diff --git a/test/Index/annotate-tokens.m b/test/Index/annotate-tokens.m index 34115d6d54b3..1a48293dfc49 100644 --- a/test/Index/annotate-tokens.m +++ b/test/Index/annotate-tokens.m @@ -146,30 +146,30 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: "@" [1:1 - 1:2] ObjCInterfaceDecl=Foo:1:12 // CHECK: Keyword: "interface" [1:2 - 1:11] ObjCInterfaceDecl=Foo:1:12 // CHECK: Identifier: "Foo" [1:12 - 1:15] ObjCInterfaceDecl=Foo:1:12 -// CHECK: Punctuation: "-" [2:1 - 2:2] ObjCInstanceMethodDecl=compare::2:1 -// CHECK: Punctuation: "(" [2:3 - 2:4] ObjCInstanceMethodDecl=compare::2:1 -// CHECK: Keyword: "int" [2:4 - 2:7] ObjCInstanceMethodDecl=compare::2:1 -// CHECK: Punctuation: ")" [2:7 - 2:8] ObjCInstanceMethodDecl=compare::2:1 -// CHECK: Identifier: "compare" [2:8 - 2:15] ObjCInstanceMethodDecl=compare::2:1 -// CHECK: Punctuation: ":" [2:15 - 2:16] ObjCInstanceMethodDecl=compare::2:1 -// CHECK: Punctuation: "(" [2:16 - 2:17] ObjCInstanceMethodDecl=compare::2:1 +// CHECK: Punctuation: "-" [2:1 - 2:2] ObjCInstanceMethodDecl=compare::2:8 +// CHECK: Punctuation: "(" [2:3 - 2:4] ObjCInstanceMethodDecl=compare::2:8 +// CHECK: Keyword: "int" [2:4 - 2:7] ObjCInstanceMethodDecl=compare::2:8 +// CHECK: Punctuation: ")" [2:7 - 2:8] ObjCInstanceMethodDecl=compare::2:8 +// CHECK: Identifier: "compare" [2:8 - 2:15] ObjCInstanceMethodDecl=compare::2:8 +// CHECK: Punctuation: ":" [2:15 - 2:16] ObjCInstanceMethodDecl=compare::2:8 +// CHECK: Punctuation: "(" [2:16 - 2:17] ObjCInstanceMethodDecl=compare::2:8 // CHECK: Identifier: "Foo" [2:17 - 2:20] ObjCClassRef=Foo:1:12 // CHECK: Punctuation: "*" [2:20 - 2:21] ParmDecl=other:2:22 (Definition) // CHECK: Punctuation: ")" [2:21 - 2:22] ParmDecl=other:2:22 (Definition) // CHECK: Identifier: "other" [2:22 - 2:27] ParmDecl=other:2:22 (Definition) -// CHECK: Punctuation: ";" [2:27 - 2:28] ObjCInstanceMethodDecl=compare::2:1 +// CHECK: Punctuation: ";" [2:27 - 2:28] ObjCInstanceMethodDecl=compare::2:8 // CHECK: Punctuation: "@" [3:1 - 3:2] ObjCInterfaceDecl=Foo:1:12 // CHECK: Keyword: "end" [3:2 - 3:5] ObjCInterfaceDecl=Foo:1:12 // CHECK: Punctuation: "@" [5:1 - 5:2] ObjCImplementationDecl=Foo:5:17 (Definition) // CHECK: Keyword: "implementation" [5:2 - 5:16] ObjCImplementationDecl=Foo:5:17 (Definition) // CHECK: Identifier: "Foo" [5:17 - 5:20] ObjCImplementationDecl=Foo:5:17 (Definition) -// CHECK: Punctuation: "-" [6:1 - 6:2] ObjCInstanceMethodDecl=compare::6:1 (Definition) -// CHECK: Punctuation: "(" [6:3 - 6:4] ObjCInstanceMethodDecl=compare::6:1 (Definition) -// CHECK: Keyword: "int" [6:4 - 6:7] ObjCInstanceMethodDecl=compare::6:1 (Definition) -// CHECK: Punctuation: ")" [6:7 - 6:8] ObjCInstanceMethodDecl=compare::6:1 (Definition) -// CHECK: Identifier: "compare" [6:8 - 6:15] ObjCInstanceMethodDecl=compare::6:1 (Definition) -// CHECK: Punctuation: ":" [6:15 - 6:16] ObjCInstanceMethodDecl=compare::6:1 (Definition) -// CHECK: Punctuation: "(" [6:16 - 6:17] ObjCInstanceMethodDecl=compare::6:1 (Definition) +// CHECK: Punctuation: "-" [6:1 - 6:2] ObjCInstanceMethodDecl=compare::6:8 (Definition) +// CHECK: Punctuation: "(" [6:3 - 6:4] ObjCInstanceMethodDecl=compare::6:8 (Definition) +// CHECK: Keyword: "int" [6:4 - 6:7] ObjCInstanceMethodDecl=compare::6:8 (Definition) +// CHECK: Punctuation: ")" [6:7 - 6:8] ObjCInstanceMethodDecl=compare::6:8 (Definition) +// CHECK: Identifier: "compare" [6:8 - 6:15] ObjCInstanceMethodDecl=compare::6:8 (Definition) +// CHECK: Punctuation: ":" [6:15 - 6:16] ObjCInstanceMethodDecl=compare::6:8 (Definition) +// CHECK: Punctuation: "(" [6:16 - 6:17] ObjCInstanceMethodDecl=compare::6:8 (Definition) // CHECK: Identifier: "Foo" [6:17 - 6:20] ObjCClassRef=Foo:1:12 // CHECK: Punctuation: "*" [6:20 - 6:21] ParmDecl=other:6:22 (Definition) // CHECK: Punctuation: ")" [6:21 - 6:22] ParmDecl=other:6:22 (Definition) @@ -213,11 +213,11 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: "@" [21:1 - 21:2] ObjCImplementationDecl=Bar:21:17 (Definition) // CHECK: Keyword: "implementation" [21:2 - 21:16] ObjCImplementationDecl=Bar:21:17 (Definition) // CHECK: Identifier: "Bar" [21:17 - 21:20] ObjCImplementationDecl=Bar:21:17 (Definition) -// CHECK: Punctuation: "-" [22:1 - 22:2] ObjCInstanceMethodDecl=method:22:1 (Definition) -// CHECK: Punctuation: "(" [22:3 - 22:4] ObjCInstanceMethodDecl=method:22:1 (Definition) -// CHECK: Keyword: "void" [22:4 - 22:8] ObjCInstanceMethodDecl=method:22:1 (Definition) -// CHECK: Punctuation: ")" [22:8 - 22:9] ObjCInstanceMethodDecl=method:22:1 (Definition) -// CHECK: Identifier: "method" [22:10 - 22:16] ObjCInstanceMethodDecl=method:22:1 (Definition) +// CHECK: Punctuation: "-" [22:1 - 22:2] ObjCInstanceMethodDecl=method:22:10 (Definition) +// CHECK: Punctuation: "(" [22:3 - 22:4] ObjCInstanceMethodDecl=method:22:10 (Definition) +// CHECK: Keyword: "void" [22:4 - 22:8] ObjCInstanceMethodDecl=method:22:10 (Definition) +// CHECK: Punctuation: ")" [22:8 - 22:9] ObjCInstanceMethodDecl=method:22:10 (Definition) +// CHECK: Identifier: "method" [22:10 - 22:16] ObjCInstanceMethodDecl=method:22:10 (Definition) // CHECK: Punctuation: "{" [23:1 - 23:2] CompoundStmt= // CHECK: Identifier: "barType" [24:5 - 24:12] TypeRef=barType:14:15 // CHECK: Identifier: "local" [24:13 - 24:18] VarDecl=local:24:13 (Definition) @@ -242,17 +242,17 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: ")" [33:33 - 33:34] ParmDecl=arg:33:34 (Definition) // CHECK: Identifier: "arg" [33:34 - 33:37] ParmDecl=arg:33:34 (Definition) // CHECK: Punctuation: ";" [33:37 - 33:38] ObjCInstanceMethodDecl=actionMethod::33:1 -// CHECK: Punctuation: "-" [34:1 - 34:2] ObjCInstanceMethodDecl=foo::34:1 -// CHECK: Punctuation: "(" [34:3 - 34:4] ObjCInstanceMethodDecl=foo::34:1 -// CHECK: Keyword: "void" [34:4 - 34:8] ObjCInstanceMethodDecl=foo::34:1 -// CHECK: Punctuation: ")" [34:8 - 34:9] ObjCInstanceMethodDecl=foo::34:1 -// CHECK: Identifier: "foo" [34:9 - 34:12] ObjCInstanceMethodDecl=foo::34:1 -// CHECK: Punctuation: ":" [34:12 - 34:13] ObjCInstanceMethodDecl=foo::34:1 -// CHECK: Punctuation: "(" [34:13 - 34:14] ObjCInstanceMethodDecl=foo::34:1 +// CHECK: Punctuation: "-" [34:1 - 34:2] ObjCInstanceMethodDecl=foo::34:9 +// CHECK: Punctuation: "(" [34:3 - 34:4] ObjCInstanceMethodDecl=foo::34:9 +// CHECK: Keyword: "void" [34:4 - 34:8] ObjCInstanceMethodDecl=foo::34:9 +// CHECK: Punctuation: ")" [34:8 - 34:9] ObjCInstanceMethodDecl=foo::34:9 +// CHECK: Identifier: "foo" [34:9 - 34:12] ObjCInstanceMethodDecl=foo::34:9 +// CHECK: Punctuation: ":" [34:12 - 34:13] ObjCInstanceMethodDecl=foo::34:9 +// CHECK: Punctuation: "(" [34:13 - 34:14] ObjCInstanceMethodDecl=foo::34:9 // CHECK: Keyword: "int" [34:14 - 34:17] ParmDecl=x:34:18 (Definition) // CHECK: Punctuation: ")" [34:17 - 34:18] ParmDecl=x:34:18 (Definition) // CHECK: Identifier: "x" [34:18 - 34:19] ParmDecl=x:34:18 (Definition) -// CHECK: Punctuation: ";" [34:19 - 34:20] ObjCInstanceMethodDecl=foo::34:1 +// CHECK: Punctuation: ";" [34:19 - 34:20] ObjCInstanceMethodDecl=foo::34:9 // CHECK: Punctuation: "@" [35:1 - 35:2] ObjCInterfaceDecl=IBActionTests:32:12 // CHECK: Keyword: "end" [35:2 - 35:5] ObjCInterfaceDecl=IBActionTests:32:12 // CHECK: Keyword: "extern" [36:1 - 36:7] @@ -265,13 +265,13 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: "@" [37:1 - 37:2] ObjCImplementationDecl=IBActionTests:37:17 (Definition) // CHECK: Keyword: "implementation" [37:2 - 37:16] ObjCImplementationDecl=IBActionTests:37:17 (Definition) // CHECK: Identifier: "IBActionTests" [37:17 - 37:30] ObjCImplementationDecl=IBActionTests:37:17 (Definition) -// CHECK: Punctuation: "-" [38:1 - 38:2] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition) -// CHECK: Punctuation: "(" [38:3 - 38:4] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition) +// CHECK: Punctuation: "-" [38:1 - 38:2] ObjCInstanceMethodDecl=actionMethod::38:14 (Definition) +// CHECK: Punctuation: "(" [38:3 - 38:4] ObjCInstanceMethodDecl=actionMethod::38:14 (Definition) // CHECK: Identifier: "IBAction" [38:4 - 38:12] macro expansion=IBAction -// CHECK: Punctuation: ")" [38:12 - 38:13] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition) -// CHECK: Identifier: "actionMethod" [38:14 - 38:26] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition) -// CHECK: Punctuation: ":" [38:26 - 38:27] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition) -// CHECK: Keyword: "in" [38:28 - 38:30] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition) [Overrides @33:1] +// CHECK: Punctuation: ")" [38:12 - 38:13] ObjCInstanceMethodDecl=actionMethod::38:14 (Definition) +// CHECK: Identifier: "actionMethod" [38:14 - 38:26] ObjCInstanceMethodDecl=actionMethod::38:14 (Definition) +// CHECK: Punctuation: ":" [38:26 - 38:27] ObjCInstanceMethodDecl=actionMethod::38:14 (Definition) +// CHECK: Keyword: "in" [38:28 - 38:30] ObjCInstanceMethodDecl=actionMethod::38:14 (Definition) // CHECK: Identifier: "id" [38:31 - 38:33] TypeRef=id:0:0 // CHECK: Punctuation: ")" [38:33 - 38:34] ParmDecl=arg:38:34 (Definition) // CHECK: Identifier: "arg" [38:34 - 38:37] ParmDecl=arg:38:34 (Definition) @@ -280,21 +280,21 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: "(" [40:18 - 40:19] CallExpr=ibaction_test:36:12 // CHECK: Punctuation: ")" [40:19 - 40:20] CallExpr=ibaction_test:36:12 // CHECK: Punctuation: ";" [40:20 - 40:21] CompoundStmt= -// CHECK: Punctuation: "[" [41:5 - 41:6] ObjCMessageExpr=foo::34:1 +// CHECK: Punctuation: "[" [41:5 - 41:6] ObjCMessageExpr=foo::34:9 // CHECK: Identifier: "self" [41:6 - 41:10] DeclRefExpr=self:0:0 -// CHECK: Identifier: "foo" [41:11 - 41:14] ObjCMessageExpr=foo::34:1 -// CHECK: Punctuation: ":" [41:14 - 41:15] ObjCMessageExpr=foo::34:1 +// CHECK: Identifier: "foo" [41:11 - 41:14] ObjCMessageExpr=foo::34:9 +// CHECK: Punctuation: ":" [41:14 - 41:15] ObjCMessageExpr=foo::34:9 // CHECK: Literal: "0" [41:15 - 41:16] IntegerLiteral= -// CHECK: Punctuation: "]" [41:16 - 41:17] ObjCMessageExpr=foo::34:1 +// CHECK: Punctuation: "]" [41:16 - 41:17] ObjCMessageExpr=foo::34:9 // CHECK: Punctuation: ";" [41:17 - 41:18] CompoundStmt= // CHECK: Punctuation: "}" [42:1 - 42:2] CompoundStmt= -// CHECK: Punctuation: "-" [43:1 - 43:2] ObjCInstanceMethodDecl=foo::43:1 (Definition) -// CHECK: Punctuation: "(" [43:3 - 43:4] ObjCInstanceMethodDecl=foo::43:1 (Definition) -// CHECK: Keyword: "void" [43:4 - 43:8] ObjCInstanceMethodDecl=foo::43:1 (Definition) -// CHECK: Punctuation: ")" [43:8 - 43:9] ObjCInstanceMethodDecl=foo::43:1 (Definition) -// CHECK: Identifier: "foo" [43:10 - 43:13] ObjCInstanceMethodDecl=foo::43:1 (Definition) -// CHECK: Punctuation: ":" [43:13 - 43:14] ObjCInstanceMethodDecl=foo::43:1 (Definition) -// CHECK: Punctuation: "(" [43:14 - 43:15] ObjCInstanceMethodDecl=foo::43:1 (Definition) +// CHECK: Punctuation: "-" [43:1 - 43:2] ObjCInstanceMethodDecl=foo::43:10 (Definition) +// CHECK: Punctuation: "(" [43:3 - 43:4] ObjCInstanceMethodDecl=foo::43:10 (Definition) +// CHECK: Keyword: "void" [43:4 - 43:8] ObjCInstanceMethodDecl=foo::43:10 (Definition) +// CHECK: Punctuation: ")" [43:8 - 43:9] ObjCInstanceMethodDecl=foo::43:10 (Definition) +// CHECK: Identifier: "foo" [43:10 - 43:13] ObjCInstanceMethodDecl=foo::43:10 (Definition) +// CHECK: Punctuation: ":" [43:13 - 43:14] ObjCInstanceMethodDecl=foo::43:10 (Definition) +// CHECK: Punctuation: "(" [43:14 - 43:15] ObjCInstanceMethodDecl=foo::43:10 (Definition) // CHECK: Keyword: "int" [43:15 - 43:18] ParmDecl=x:43:19 (Definition) // CHECK: Punctuation: ")" [43:18 - 43:19] ParmDecl=x:43:19 (Definition) // CHECK: Identifier: "x" [43:19 - 43:20] ParmDecl=x:43:19 (Definition) @@ -344,35 +344,35 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: "@" [65:1 - 65:2] ObjCInterfaceDecl=R7974151:65:12 // CHECK: Keyword: "interface" [65:2 - 65:11] ObjCInterfaceDecl=R7974151:65:12 // CHECK: Identifier: "R7974151" [65:12 - 65:20] ObjCInterfaceDecl=R7974151:65:12 -// CHECK: Punctuation: "-" [66:1 - 66:2] ObjCInstanceMethodDecl=foo::66:1 -// CHECK: Punctuation: "(" [66:3 - 66:4] ObjCInstanceMethodDecl=foo::66:1 -// CHECK: Keyword: "int" [66:4 - 66:7] ObjCInstanceMethodDecl=foo::66:1 -// CHECK: Punctuation: ")" [66:7 - 66:8] ObjCInstanceMethodDecl=foo::66:1 -// CHECK: Identifier: "foo" [66:9 - 66:12] ObjCInstanceMethodDecl=foo::66:1 -// CHECK: Punctuation: ":" [66:12 - 66:13] ObjCInstanceMethodDecl=foo::66:1 -// CHECK: Punctuation: "(" [66:13 - 66:14] ObjCInstanceMethodDecl=foo::66:1 +// CHECK: Punctuation: "-" [66:1 - 66:2] ObjCInstanceMethodDecl=foo::66:9 +// CHECK: Punctuation: "(" [66:3 - 66:4] ObjCInstanceMethodDecl=foo::66:9 +// CHECK: Keyword: "int" [66:4 - 66:7] ObjCInstanceMethodDecl=foo::66:9 +// CHECK: Punctuation: ")" [66:7 - 66:8] ObjCInstanceMethodDecl=foo::66:9 +// CHECK: Identifier: "foo" [66:9 - 66:12] ObjCInstanceMethodDecl=foo::66:9 +// CHECK: Punctuation: ":" [66:12 - 66:13] ObjCInstanceMethodDecl=foo::66:9 +// CHECK: Punctuation: "(" [66:13 - 66:14] ObjCInstanceMethodDecl=foo::66:9 // CHECK: Keyword: "int" [66:14 - 66:17] ParmDecl=arg:66:18 (Definition) // CHECK: Punctuation: ")" [66:17 - 66:18] ParmDecl=arg:66:18 (Definition) // CHECK: Identifier: "arg" [66:18 - 66:21] ParmDecl=arg:66:18 (Definition) -// CHECK: Punctuation: ";" [66:21 - 66:22] ObjCInstanceMethodDecl=foo::66:1 -// CHECK: Punctuation: "-" [67:1 - 67:2] ObjCInstanceMethodDecl=method:67:1 -// CHECK: Punctuation: "(" [67:3 - 67:4] ObjCInstanceMethodDecl=method:67:1 -// CHECK: Keyword: "int" [67:4 - 67:7] ObjCInstanceMethodDecl=method:67:1 -// CHECK: Punctuation: ")" [67:7 - 67:8] ObjCInstanceMethodDecl=method:67:1 -// CHECK: Identifier: "method" [67:9 - 67:15] ObjCInstanceMethodDecl=method:67:1 -// CHECK: Punctuation: ";" [67:15 - 67:16] ObjCInstanceMethodDecl=method:67:1 +// CHECK: Punctuation: ";" [66:21 - 66:22] ObjCInstanceMethodDecl=foo::66:9 +// CHECK: Punctuation: "-" [67:1 - 67:2] ObjCInstanceMethodDecl=method:67:9 +// CHECK: Punctuation: "(" [67:3 - 67:4] ObjCInstanceMethodDecl=method:67:9 +// CHECK: Keyword: "int" [67:4 - 67:7] ObjCInstanceMethodDecl=method:67:9 +// CHECK: Punctuation: ")" [67:7 - 67:8] ObjCInstanceMethodDecl=method:67:9 +// CHECK: Identifier: "method" [67:9 - 67:15] ObjCInstanceMethodDecl=method:67:9 +// CHECK: Punctuation: ";" [67:15 - 67:16] ObjCInstanceMethodDecl=method:67:9 // CHECK: Punctuation: "@" [68:1 - 68:2] ObjCInterfaceDecl=R7974151:65:12 // CHECK: Keyword: "end" [68:2 - 68:5] ObjCInterfaceDecl=R7974151:65:12 // CHECK: Punctuation: "@" [70:1 - 70:2] ObjCImplementationDecl=R7974151:70:17 (Definition) // CHECK: Keyword: "implementation" [70:2 - 70:16] ObjCImplementationDecl=R7974151:70:17 (Definition) // CHECK: Identifier: "R7974151" [70:17 - 70:25] ObjCImplementationDecl=R7974151:70:17 (Definition) -// CHECK: Punctuation: "-" [71:1 - 71:2] ObjCInstanceMethodDecl=foo::71:1 (Definition) -// CHECK: Punctuation: "(" [71:3 - 71:4] ObjCInstanceMethodDecl=foo::71:1 (Definition) -// CHECK: Keyword: "int" [71:4 - 71:7] ObjCInstanceMethodDecl=foo::71:1 (Definition) -// CHECK: Punctuation: ")" [71:7 - 71:8] ObjCInstanceMethodDecl=foo::71:1 (Definition) -// CHECK: Identifier: "foo" [71:9 - 71:12] ObjCInstanceMethodDecl=foo::71:1 (Definition) -// CHECK: Punctuation: ":" [71:12 - 71:13] ObjCInstanceMethodDecl=foo::71:1 (Definition) -// CHECK: Punctuation: "(" [71:13 - 71:14] ObjCInstanceMethodDecl=foo::71:1 (Definition) +// CHECK: Punctuation: "-" [71:1 - 71:2] ObjCInstanceMethodDecl=foo::71:9 (Definition) +// CHECK: Punctuation: "(" [71:3 - 71:4] ObjCInstanceMethodDecl=foo::71:9 (Definition) +// CHECK: Keyword: "int" [71:4 - 71:7] ObjCInstanceMethodDecl=foo::71:9 (Definition) +// CHECK: Punctuation: ")" [71:7 - 71:8] ObjCInstanceMethodDecl=foo::71:9 (Definition) +// CHECK: Identifier: "foo" [71:9 - 71:12] ObjCInstanceMethodDecl=foo::71:9 (Definition) +// CHECK: Punctuation: ":" [71:12 - 71:13] ObjCInstanceMethodDecl=foo::71:9 (Definition) +// CHECK: Punctuation: "(" [71:13 - 71:14] ObjCInstanceMethodDecl=foo::71:9 (Definition) // CHECK: Keyword: "int" [71:14 - 71:17] ParmDecl=arg:71:18 (Definition) // CHECK: Punctuation: ")" [71:17 - 71:18] ParmDecl=arg:71:18 (Definition) // CHECK: Identifier: "arg" [71:18 - 71:21] ParmDecl=arg:71:18 (Definition) @@ -381,43 +381,43 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Identifier: "arg" [72:10 - 72:13] DeclRefExpr=arg:71:18 // CHECK: Punctuation: ";" [72:13 - 72:14] CompoundStmt= // CHECK: Punctuation: "}" [73:1 - 73:2] CompoundStmt= -// CHECK: Punctuation: "-" [74:1 - 74:2] ObjCInstanceMethodDecl=method:74:1 (Definition) -// CHECK: Punctuation: "(" [74:3 - 74:4] ObjCInstanceMethodDecl=method:74:1 (Definition) -// CHECK: Keyword: "int" [74:4 - 74:7] ObjCInstanceMethodDecl=method:74:1 (Definition) -// CHECK: Punctuation: ")" [74:7 - 74:8] ObjCInstanceMethodDecl=method:74:1 (Definition) -// CHECK: Identifier: "method" [74:9 - 74:15] ObjCInstanceMethodDecl=method:74:1 (Definition) +// CHECK: Punctuation: "-" [74:1 - 74:2] ObjCInstanceMethodDecl=method:74:9 (Definition) +// CHECK: Punctuation: "(" [74:3 - 74:4] ObjCInstanceMethodDecl=method:74:9 (Definition) +// CHECK: Keyword: "int" [74:4 - 74:7] ObjCInstanceMethodDecl=method:74:9 (Definition) +// CHECK: Punctuation: ")" [74:7 - 74:8] ObjCInstanceMethodDecl=method:74:9 (Definition) +// CHECK: Identifier: "method" [74:9 - 74:15] ObjCInstanceMethodDecl=method:74:9 (Definition) // CHECK: Punctuation: "{" [75:1 - 75:2] CompoundStmt= // CHECK: Keyword: "int" [76:5 - 76:8] VarDecl=local:76:9 (Definition) // CHECK: Identifier: "local" [76:9 - 76:14] VarDecl=local:76:9 (Definition) // CHECK: Punctuation: "=" [76:15 - 76:16] VarDecl=local:76:9 (Definition) -// CHECK: Punctuation: "[" [76:17 - 76:18] ObjCMessageExpr=foo::66:1 +// CHECK: Punctuation: "[" [76:17 - 76:18] ObjCMessageExpr=foo::66:9 // CHECK: Identifier: "self" [76:18 - 76:22] DeclRefExpr=self:0:0 -// CHECK: Identifier: "foo" [76:23 - 76:26] ObjCMessageExpr=foo::66:1 -// CHECK: Punctuation: ":" [76:26 - 76:27] ObjCMessageExpr=foo::66:1 +// CHECK: Identifier: "foo" [76:23 - 76:26] ObjCMessageExpr=foo::66:9 +// CHECK: Punctuation: ":" [76:26 - 76:27] ObjCMessageExpr=foo::66:9 // CHECK: Identifier: "VAL" [76:27 - 76:30] macro expansion=VAL:63:9 -// CHECK: Punctuation: "]" [76:30 - 76:31] ObjCMessageExpr=foo::66:1 +// CHECK: Punctuation: "]" [76:30 - 76:31] ObjCMessageExpr=foo::66:9 // CHECK: Punctuation: ";" [76:31 - 76:32] DeclStmt= // CHECK: Keyword: "int" [77:5 - 77:8] VarDecl=second:77:9 (Definition) // CHECK: Identifier: "second" [77:9 - 77:15] VarDecl=second:77:9 (Definition) // CHECK: Punctuation: "=" [77:16 - 77:17] VarDecl=second:77:9 (Definition) -// CHECK: Punctuation: "[" [77:18 - 77:19] ObjCMessageExpr=foo::66:1 +// CHECK: Punctuation: "[" [77:18 - 77:19] ObjCMessageExpr=foo::66:9 // CHECK: Identifier: "self" [77:19 - 77:23] DeclRefExpr=self:0:0 -// CHECK: Identifier: "foo" [77:24 - 77:27] ObjCMessageExpr=foo::66:1 -// CHECK: Punctuation: ":" [77:27 - 77:28] ObjCMessageExpr=foo::66:1 +// CHECK: Identifier: "foo" [77:24 - 77:27] ObjCMessageExpr=foo::66:9 +// CHECK: Punctuation: ":" [77:27 - 77:28] ObjCMessageExpr=foo::66:9 // CHECK: Literal: "0" [77:28 - 77:29] IntegerLiteral= -// CHECK: Punctuation: "]" [77:29 - 77:30] ObjCMessageExpr=foo::66:1 +// CHECK: Punctuation: "]" [77:29 - 77:30] ObjCMessageExpr=foo::66:9 // CHECK: Punctuation: ";" [77:30 - 77:31] DeclStmt= // CHECK: Keyword: "return" [78:5 - 78:11] ReturnStmt= // CHECK: Identifier: "local" [78:12 - 78:17] DeclRefExpr=local:76:9 // CHECK: Punctuation: ";" [78:17 - 78:18] CompoundStmt= // CHECK: Punctuation: "}" [79:1 - 79:2] CompoundStmt= -// CHECK: Punctuation: "-" [80:1 - 80:2] ObjCInstanceMethodDecl=othermethod::80:1 (Definition) -// CHECK: Punctuation: "(" [80:3 - 80:4] ObjCInstanceMethodDecl=othermethod::80:1 (Definition) -// CHECK: Keyword: "int" [80:4 - 80:7] ObjCInstanceMethodDecl=othermethod::80:1 (Definition) -// CHECK: Punctuation: ")" [80:7 - 80:8] ObjCInstanceMethodDecl=othermethod::80:1 (Definition) -// CHECK: Identifier: "othermethod" [80:8 - 80:19] ObjCInstanceMethodDecl=othermethod::80:1 (Definition) -// CHECK: Punctuation: ":" [80:19 - 80:20] ObjCInstanceMethodDecl=othermethod::80:1 (Definition) -// CHECK: Punctuation: "(" [80:20 - 80:21] ObjCInstanceMethodDecl=othermethod::80:1 (Definition) +// CHECK: Punctuation: "-" [80:1 - 80:2] ObjCInstanceMethodDecl=othermethod::80:8 (Definition) +// CHECK: Punctuation: "(" [80:3 - 80:4] ObjCInstanceMethodDecl=othermethod::80:8 (Definition) +// CHECK: Keyword: "int" [80:4 - 80:7] ObjCInstanceMethodDecl=othermethod::80:8 (Definition) +// CHECK: Punctuation: ")" [80:7 - 80:8] ObjCInstanceMethodDecl=othermethod::80:8 (Definition) +// CHECK: Identifier: "othermethod" [80:8 - 80:19] ObjCInstanceMethodDecl=othermethod::80:8 (Definition) +// CHECK: Punctuation: ":" [80:19 - 80:20] ObjCInstanceMethodDecl=othermethod::80:8 (Definition) +// CHECK: Punctuation: "(" [80:20 - 80:21] ObjCInstanceMethodDecl=othermethod::80:8 (Definition) // CHECK: Identifier: "IBOutletTests" [80:21 - 80:34] ObjCClassRef=IBOutletTests:51:12 // CHECK: Punctuation: "*" [80:35 - 80:36] ParmDecl=ibt:80:37 (Definition) // CHECK: Punctuation: ")" [80:36 - 80:37] ParmDecl=ibt:80:37 (Definition) @@ -452,8 +452,8 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: ")" [88:24 - 88:25] ObjCProtocolExpr=Proto:85:1 // CHECK: Punctuation: ";" [88:25 - 88:26] CompoundStmt= // CHECK: Punctuation: "}" [89:1 - 89:2] CompoundStmt= -// CHECK: Punctuation: "@" [93:1 - 93:2] UnexposedDecl=[93:8] -// CHECK: Keyword: "class" [93:2 - 93:7] UnexposedDecl=[93:8] +// CHECK: Punctuation: "@" [93:1 - 93:2] ObjCInterfaceDecl=Rdar8595462_A:93:8 +// CHECK: Keyword: "class" [93:2 - 93:7] ObjCInterfaceDecl=Rdar8595462_A:93:8 // CHECK: Identifier: "Rdar8595462_A" [93:8 - 93:21] ObjCClassRef=Rdar8595462_A:93:8 // CHECK: Punctuation: ";" [93:21 - 93:22] // CHECK: Punctuation: "@" [94:1 - 94:2] ObjCInterfaceDecl=Rdar8595462_B:94:12 @@ -517,14 +517,14 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK-INSIDE_BLOCK: Keyword: "int" [127:5 - 127:8] VarDecl=result:127:9 (Definition) // CHECK-INSIDE_BLOCK: Identifier: "result" [127:9 - 127:15] VarDecl=result:127:9 (Definition) // CHECK-INSIDE_BLOCK: Punctuation: "=" [127:16 - 127:17] VarDecl=result:127:9 (Definition) -// CHECK-INSIDE_BLOCK: Punctuation: "[" [127:18 - 127:19] ObjCMessageExpr=blah::124:1 +// CHECK-INSIDE_BLOCK: Punctuation: "[" [127:18 - 127:19] ObjCMessageExpr=blah::124:8 // CHECK-INSIDE_BLOCK: Identifier: "self" [127:19 - 127:23] DeclRefExpr=self:0:0 -// CHECK-INSIDE_BLOCK: Identifier: "blah" [127:24 - 127:28] ObjCMessageExpr=blah::124:1 -// CHECK-INSIDE_BLOCK: Punctuation: ":" [127:28 - 127:29] ObjCMessageExpr=blah::124:1 +// CHECK-INSIDE_BLOCK: Identifier: "blah" [127:24 - 127:28] ObjCMessageExpr=blah::124:8 +// CHECK-INSIDE_BLOCK: Punctuation: ":" [127:28 - 127:29] ObjCMessageExpr=blah::124:8 // CHECK-INSIDE_BLOCK: Literal: "5" [127:29 - 127:30] IntegerLiteral= -// CHECK-INSIDE_BLOCK: Punctuation: "," [127:30 - 127:31] ObjCMessageExpr=blah::124:1 +// CHECK-INSIDE_BLOCK: Punctuation: "," [127:30 - 127:31] ObjCMessageExpr=blah::124:8 // CHECK-INSIDE_BLOCK: Identifier: "x" [127:32 - 127:33] DeclRefExpr=x:125:19 -// CHECK-INSIDE_BLOCK: Punctuation: "]" [127:33 - 127:34] ObjCMessageExpr=blah::124:1 +// CHECK-INSIDE_BLOCK: Punctuation: "]" [127:33 - 127:34] ObjCMessageExpr=blah::124:8 // CHECK-INSIDE_BLOCK: Punctuation: ";" [127:34 - 127:35] DeclStmt= // CHECK-INSIDE_BLOCK: Identifier: "Rdar8778404" [128:5 - 128:16] ObjCClassRef=Rdar8778404:120:12 // CHECK-INSIDE_BLOCK: Punctuation: "*" [128:17 - 128:18] VarDecl=a:128:18 (Definition) @@ -536,13 +536,13 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK-PROP-AFTER-METHOD: Punctuation: "@" [134:1 - 134:2] ObjCInterfaceDecl=Rdar8062781:134:12 // CHECK-PROP-AFTER-METHOD: Keyword: "interface" [134:2 - 134:11] ObjCInterfaceDecl=Rdar8062781:134:12 // CHECK-PROP-AFTER-METHOD: Identifier: "Rdar8062781" [134:12 - 134:23] ObjCInterfaceDecl=Rdar8062781:134:12 -// CHECK-PROP-AFTER-METHOD: Punctuation: "+" [135:1 - 135:2] ObjCClassMethodDecl=getB:135:1 -// CHECK-PROP-AFTER-METHOD: Punctuation: "(" [135:3 - 135:4] ObjCClassMethodDecl=getB:135:1 +// CHECK-PROP-AFTER-METHOD: Punctuation: "+" [135:1 - 135:2] ObjCClassMethodDecl=getB:135:9 +// CHECK-PROP-AFTER-METHOD: Punctuation: "(" [135:3 - 135:4] ObjCClassMethodDecl=getB:135:9 // CHECK-PROP-AFTER-METHOD: Identifier: "Foo" [135:4 - 135:7] ObjCClassRef=Foo:1:12 -// CHECK-PROP-AFTER-METHOD: Punctuation: "*" [135:7 - 135:8] ObjCClassMethodDecl=getB:135:1 -// CHECK-PROP-AFTER-METHOD: Punctuation: ")" [135:8 - 135:9] ObjCClassMethodDecl=getB:135:1 -// CHECK-PROP-AFTER-METHOD: Identifier: "getB" [135:9 - 135:13] ObjCClassMethodDecl=getB:135:1 -// CHECK-PROP-AFTER-METHOD: Punctuation: ";" [135:13 - 135:14] ObjCClassMethodDecl=getB:135:1 +// CHECK-PROP-AFTER-METHOD: Punctuation: "*" [135:7 - 135:8] ObjCClassMethodDecl=getB:135:9 +// CHECK-PROP-AFTER-METHOD: Punctuation: ")" [135:8 - 135:9] ObjCClassMethodDecl=getB:135:9 +// CHECK-PROP-AFTER-METHOD: Identifier: "getB" [135:9 - 135:13] ObjCClassMethodDecl=getB:135:9 +// CHECK-PROP-AFTER-METHOD: Punctuation: ";" [135:13 - 135:14] ObjCClassMethodDecl=getB:135:9 // CHECK-PROP-AFTER-METHOD: Punctuation: "@" [136:1 - 136:2] ObjCPropertyDecl=blah:136:38 // CHECK-PROP-AFTER-METHOD: Keyword: "property" [136:2 - 136:10] ObjCPropertyDecl=blah:136:38 // CHECK-PROP-AFTER-METHOD: Punctuation: "(" [136:11 - 136:12] ObjCPropertyDecl=blah:136:38 @@ -567,7 +567,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK-PROP-AFTER-METHOD: Punctuation: ";" [137:39 - 137:40] ObjCInterfaceDecl=Rdar8062781:134:12 // CHECK-PROP-AFTER-METHOD: Punctuation: "@" [138:1 - 138:2] ObjCInterfaceDecl=Rdar8062781:134:12 -// RUN: c-index-test -test-annotate-tokens=%s:141:1:142:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' -ccc-host-triple x86_64-apple-macosx10.7.0 | FileCheck -check-prefix=CHECK-WITH-WEAK %s +// RUN: c-index-test -test-annotate-tokens=%s:141:1:142:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' -target x86_64-apple-macosx10.7.0 | FileCheck -check-prefix=CHECK-WITH-WEAK %s // CHECK-WITH-WEAK: Identifier: "__weak" [141:3 - 141:9] macro expansion // CHECK-WITH-WEAK: Identifier: "Foo" [141:10 - 141:13] ObjCClassRef=Foo:1:12 // CHECK-WITH-WEAK: Punctuation: "*" [141:14 - 141:15] ObjCIvarDecl=foo:141:15 (Definition) diff --git a/test/Index/annotate-toplevel-in-objccontainer.m b/test/Index/annotate-toplevel-in-objccontainer.m new file mode 100644 index 000000000000..56b7871d9bc2 --- /dev/null +++ b/test/Index/annotate-toplevel-in-objccontainer.m @@ -0,0 +1,33 @@ +@interface Foo +void func1(int); +void func2(int); + +-(void)meth1; +-(void)meth2; +@end + +@implementation Foo +void func(int); +static int glob1; +static int glob2; + +-(void)meth1 {} +-(void)meth2 {} +@end + +// RUN: c-index-test -write-pch %t.h.pch -x objective-c-header %s.h + +// RUN: c-index-test -test-annotate-tokens=%s:5:1:7:1 %s -include %t.h \ +// RUN: | FileCheck -check-prefix=INTER %s +// CHECK-INTER: Identifier: "meth1" [5:8 - 5:13] ObjCInstanceMethodDecl=meth1:5:8 +// CHECK-INTER: Identifier: "meth2" [6:8 - 6:13] ObjCInstanceMethodDecl=meth2:6:8 + +// RUN: c-index-test -test-annotate-tokens=%s:14:1:16:1 %s -include %t.h \ +// RUN: | FileCheck -check-prefix=IMPL %s +// CHECK-IMPL: Identifier: "meth1" [14:8 - 14:13] ObjCInstanceMethodDecl=meth1:14:8 (Definition) +// CHECK-IMPL: Identifier: "meth2" [15:8 - 15:13] ObjCInstanceMethodDecl=meth2:15:8 (Definition) + +// RUN: c-index-test -test-annotate-tokens=%s.h:7:1:9:1 %s -include %t.h \ +// RUN: | FileCheck -check-prefix=PCH %s +// CHECK-PCH: Identifier: "meth1" [7:8 - 7:13] ObjCInstanceMethodDecl=meth1:7:8 +// CHECK-PCH: Identifier: "meth2" [8:8 - 8:13] ObjCInstanceMethodDecl=meth2:8:8 diff --git a/test/Index/annotate-toplevel-in-objccontainer.m.h b/test/Index/annotate-toplevel-in-objccontainer.m.h new file mode 100644 index 000000000000..fe507fc0b7cd --- /dev/null +++ b/test/Index/annotate-toplevel-in-objccontainer.m.h @@ -0,0 +1,9 @@ +@interface FooPCH +void funcPCH1(int); +void funcPCH2(int); + +enum E { Cake }; + +-(void)meth1; +-(void)meth2; +@end diff --git a/test/Index/asm-attribute.c b/test/Index/asm-attribute.c new file mode 100644 index 000000000000..f9524598b608 --- /dev/null +++ b/test/Index/asm-attribute.c @@ -0,0 +1,6 @@ +int foo(int x) __asm__("_foo_"); + +// RUN: c-index-test -test-load-source all %s | FileCheck %s +// CHECK: asm-attribute.c:1:5: FunctionDecl=foo:1:5 Extent=[1:1 - 1:32] +// FIXME: Location below. +// CHECK: <invalid loc>:0:0: asm label=_foo_ Extent=[1:24 - 1:31] diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m index 62cc4d422ca2..251d73b3f819 100644 --- a/test/Index/c-index-api-loadTU-test.m +++ b/test/Index/c-index-api-loadTU-test.m @@ -79,29 +79,29 @@ struct X0 {}; // CHECK: c-index-api-loadTU-test.m:6:32: ObjCIvarDecl=myoutlet:6:32 (Definition) Extent=[6:3 - 6:40] // CHECK: <invalid loc>:0:0: attribute(iboutlet)= // CHECK: c-index-api-loadTU-test.m:6:29: TypeRef=id:0:0 Extent=[6:29 - 6:31] -// CHECK: c-index-api-loadTU-test.m:8:1: ObjCInstanceMethodDecl=myMessage::8:1 Extent=[8:1 - 8:54] +// CHECK: c-index-api-loadTU-test.m:8:36: ObjCInstanceMethodDecl=myMessage::8:36 Extent=[8:1 - 8:54] // CHECK: <invalid loc>:0:0: attribute(ibaction)= // CHECK: c-index-api-loadTU-test.m:8:50: ParmDecl=msg:8:50 (Definition) Extent=[8:47 - 8:53] // CHECK: c-index-api-loadTU-test.m:8:47: TypeRef=id:0:0 Extent=[8:47 - 8:49] -// CHECK: c-index-api-loadTU-test.m:9:1: ObjCInstanceMethodDecl=foo:9:1 (deprecated) Extent=[9:1 - 9:35] -// CHECK: c-index-api-loadTU-test.m:10:1: ObjCClassMethodDecl=fooC:10:1 Extent=[10:1 - 10:8] +// CHECK: c-index-api-loadTU-test.m:9:3: ObjCInstanceMethodDecl=foo:9:3 (deprecated) Extent=[9:1 - 9:35] +// CHECK: c-index-api-loadTU-test.m:10:3: ObjCClassMethodDecl=fooC:10:3 Extent=[10:1 - 10:8] // CHECK: c-index-api-loadTU-test.m:14:12: ObjCInterfaceDecl=Bar:14:12 Extent=[14:1 - 18:5] // CHECK: c-index-api-loadTU-test.m:14:18: ObjCSuperClassRef=Foo:4:12 Extent=[14:18 - 14:21] // CHECK: c-index-api-loadTU-test.m:20:12: ObjCCategoryDecl=FooCat:20:12 Extent=[20:1 - 23:5] // CHECK: c-index-api-loadTU-test.m:20:12: ObjCClassRef=Foo:4:12 Extent=[20:12 - 20:15] -// CHECK: c-index-api-loadTU-test.m:21:1: ObjCInstanceMethodDecl=catMethodWithFloat::21:1 Extent=[21:1 - 21:41] +// CHECK: c-index-api-loadTU-test.m:21:9: ObjCInstanceMethodDecl=catMethodWithFloat::21:9 Extent=[21:1 - 21:41] // CHECK: c-index-api-loadTU-test.m:21:36: ParmDecl=fArg:21:36 (Definition) Extent=[21:29 - 21:40] -// CHECK: c-index-api-loadTU-test.m:22:1: ObjCInstanceMethodDecl=floatMethod:22:1 Extent=[22:1 - 22:23] +// CHECK: c-index-api-loadTU-test.m:22:11: ObjCInstanceMethodDecl=floatMethod:22:11 Extent=[22:1 - 22:23] // CHECK: c-index-api-loadTU-test.m:25:11: ObjCProtocolDecl=Proto:25:11 (Definition) Extent=[25:1 - 27:5] -// CHECK: c-index-api-loadTU-test.m:26:1: ObjCInstanceMethodDecl=pMethod:26:1 Extent=[26:1 - 26:11] +// CHECK: c-index-api-loadTU-test.m:26:3: ObjCInstanceMethodDecl=pMethod:26:3 Extent=[26:1 - 26:11] // CHECK: c-index-api-loadTU-test.m:29:11: ObjCProtocolDecl=SubP:29:11 (Definition) Extent=[29:1 - 31:5] // CHECK: c-index-api-loadTU-test.m:29:17: ObjCProtocolRef=Proto:25:11 Extent=[29:17 - 29:22] -// CHECK: c-index-api-loadTU-test.m:30:1: ObjCInstanceMethodDecl=spMethod:30:1 Extent=[30:1 - 30:12] +// CHECK: c-index-api-loadTU-test.m:30:3: ObjCInstanceMethodDecl=spMethod:30:3 Extent=[30:1 - 30:12] // CHECK: c-index-api-loadTU-test.m:33:12: ObjCInterfaceDecl=Baz:33:12 Extent=[33:1 - 40:5] // CHECK: c-index-api-loadTU-test.m:33:18: ObjCSuperClassRef=Bar:14:12 Extent=[33:18 - 33:21] // CHECK: c-index-api-loadTU-test.m:33:23: ObjCProtocolRef=SubP:29:11 Extent=[33:23 - 33:27] // CHECK: c-index-api-loadTU-test.m:35:9: ObjCIvarDecl=_anIVar:35:9 (Definition) Extent=[35:5 - 35:16] -// CHECK: c-index-api-loadTU-test.m:38:1: ObjCInstanceMethodDecl=bazMethod:38:1 Extent=[38:1 - 38:21] +// CHECK: c-index-api-loadTU-test.m:38:11: ObjCInstanceMethodDecl=bazMethod:38:11 Extent=[38:1 - 38:21] // CHECK: c-index-api-loadTU-test.m:38:4: ObjCClassRef=Foo:4:12 Extent=[38:4 - 38:7] // CHECK: c-index-api-loadTU-test.m:42:1: EnumDecl=:42:1 (Definition) Extent=[42:1 - 44:2] // CHECK: c-index-api-loadTU-test.m:43:3: EnumConstantDecl=someEnum:43:3 (Definition) Extent=[43:3 - 43:11] @@ -112,13 +112,13 @@ struct X0 {}; // CHECK: c-index-api-loadTU-test.m:47:2: ObjCClassRef=Baz:33:12 Extent=[47:2 - 47:5] // CHECK: c-index-api-loadTU-test.m:48:5: VarDecl=a:48:5 (Definition) Extent=[48:2 - 48:18] // CHECK: c-index-api-loadTU-test.m:48:2: TypeRef=id:0:0 Extent=[48:2 - 48:4] -// CHECK: c-index-api-loadTU-test.m:48:9: ObjCMessageExpr=foo:9:1 Extent=[48:9 - 48:18] +// CHECK: c-index-api-loadTU-test.m:48:9: ObjCMessageExpr=foo:9:3 Extent=[48:9 - 48:18] // CHECK: c-index-api-loadTU-test.m:48:10: DeclRefExpr=bee:47:8 Extent=[48:10 - 48:13] // CHECK: c-index-api-loadTU-test.m:49:12: VarDecl=c:49:12 (Definition) Extent=[49:2 - 49:26] // CHECK: c-index-api-loadTU-test.m:49:2: TypeRef=id:0:0 Extent=[49:2 - 49:4] // CHECK: c-index-api-loadTU-test.m:49:6: ObjCProtocolRef=SubP:29:11 Extent=[49:6 - 49:10] -// CHECK: c-index-api-loadTU-test.m:49:16: UnexposedExpr=fooC:10:1 Extent=[49:16 - 49:26] -// CHECK: c-index-api-loadTU-test.m:49:16: ObjCMessageExpr=fooC:10:1 Extent=[49:16 - 49:26] +// CHECK: c-index-api-loadTU-test.m:49:16: UnexposedExpr=fooC:10:3 Extent=[49:16 - 49:26] +// CHECK: c-index-api-loadTU-test.m:49:16: ObjCMessageExpr=fooC:10:3 Extent=[49:16 - 49:26] // CHECK: c-index-api-loadTU-test.m:49:17: ObjCClassRef=Foo:4:12 Extent=[49:17 - 49:20] // CHECK: c-index-api-loadTU-test.m:50:13: VarDecl=d:50:13 (Definition) Extent=[50:2 - 50:14] // CHECK: c-index-api-loadTU-test.m:50:2: TypeRef=id:0:0 Extent=[50:2 - 50:4] @@ -127,11 +127,11 @@ struct X0 {}; // CHECK: c-index-api-loadTU-test.m:51:2: DeclRefExpr=d:50:13 Extent=[51:2 - 51:3] // CHECK: c-index-api-loadTU-test.m:51:6: UnexposedExpr=c:49:12 Extent=[51:6 - 51:7] // CHECK: c-index-api-loadTU-test.m:51:6: DeclRefExpr=c:49:12 Extent=[51:6 - 51:7] -// CHECK: c-index-api-loadTU-test.m:52:2: ObjCMessageExpr=pMethod:26:1 Extent=[52:2 - 52:13] +// CHECK: c-index-api-loadTU-test.m:52:2: ObjCMessageExpr=pMethod:26:3 Extent=[52:2 - 52:13] // CHECK: c-index-api-loadTU-test.m:52:3: DeclRefExpr=d:50:13 Extent=[52:3 - 52:4] -// CHECK: c-index-api-loadTU-test.m:53:2: ObjCMessageExpr=catMethodWithFloat::21:1 Extent=[53:2 - 53:44] +// CHECK: c-index-api-loadTU-test.m:53:2: ObjCMessageExpr=catMethodWithFloat::21:9 Extent=[53:2 - 53:44] // CHECK: c-index-api-loadTU-test.m:53:3: DeclRefExpr=bee:47:8 Extent=[53:3 - 53:6] -// CHECK: c-index-api-loadTU-test.m:53:26: ObjCMessageExpr=floatMethod:22:1 Extent=[53:26 - 53:43] +// CHECK: c-index-api-loadTU-test.m:53:26: ObjCMessageExpr=floatMethod:22:11 Extent=[53:26 - 53:43] // CHECK: c-index-api-loadTU-test.m:53:27: DeclRefExpr=bee:47:8 Extent=[53:27 - 53:30] // CHECK: c-index-api-loadTU-test.m:54:3: CallExpr=main:46:5 Extent=[54:3 - 54:37] // CHECK: c-index-api-loadTU-test.m:54:3: UnexposedExpr=main:46:5 Extent=[54:3 - 54:7] @@ -145,7 +145,7 @@ struct X0 {}; // CHECK: c-index-api-loadTU-test.m:64:29: ObjCIvarDecl=anOutletCollection:64:29 (Definition) Extent=[59:39 - 64:47] // CHECK: <invalid loc>:0:0: attribute(iboutletcollection)= [IBOutletCollection=ObjCObjectPointer] // CHECK: c-index-api-loadTU-test.m:64:26: TypeRef=id:0:0 Extent=[64:26 - 64:28] -// CHECK: c-index-api-loadTU-test.m:66:1: ObjCInstanceMethodDecl=actionMethod::66:1 Extent=[66:1 - 66:35] +// CHECK: c-index-api-loadTU-test.m:66:14: ObjCInstanceMethodDecl=actionMethod::66:14 Extent=[66:1 - 66:35] // CHECK: <invalid loc>:0:0: attribute(ibaction)= // CHECK: c-index-api-loadTU-test.m:66:31: ParmDecl=arg:66:31 (Definition) Extent=[66:28 - 66:34] // CHECK: c-index-api-loadTU-test.m:66:28: TypeRef=id:0:0 Extent=[66:28 - 66:30] diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m index c7410c9bbfa3..bae597995541 100644 --- a/test/Index/c-index-getCursor-test.m +++ b/test/Index/c-index-getCursor-test.m @@ -61,9 +61,9 @@ void f() { // CHECK: [1:1 - 3:1] Invalid Cursor => NoDeclFound // CHECK: [3:1 - 7:1] ObjCInterfaceDecl=Foo:3:12 -// CHECK: [7:1 - 7:7] ObjCInstanceMethodDecl=foo:7:1 +// CHECK: [7:1 - 7:7] ObjCInstanceMethodDecl=foo:7:3 // CHECK: [7:7 - 8:1] ObjCInterfaceDecl=Foo:3:12 -// CHECK: [8:1 - 8:8] ObjCClassMethodDecl=fooC:8:1 +// CHECK: [8:1 - 8:8] ObjCClassMethodDecl=fooC:8:3 // CHECK: [8:8 - 10:5] ObjCInterfaceDecl=Foo:3:12 // CHECK: [10:5 - 12:1] Invalid Cursor => NoDeclFound // CHECK: [12:1 - 12:18] ObjCInterfaceDecl=Bar:12:12 @@ -73,21 +73,21 @@ void f() { // CHECK: [18:1 - 18:12] ObjCCategoryDecl=FooCat:18:12 // CHECK: [18:12 - 18:15] ObjCClassRef=Foo:3:12 // CHECK: [18:15 - 19:1] ObjCCategoryDecl=FooCat:18:12 -// CHECK: [19:1 - 19:29] ObjCInstanceMethodDecl=catMethodWithFloat::19:1 +// CHECK: [19:1 - 19:29] ObjCInstanceMethodDecl=catMethodWithFloat::19:9 // CHECK: [19:29 - 19:40] ParmDecl=fArg:19:36 (Definition) -// CHECK: [19:40 - 19:41] ObjCInstanceMethodDecl=catMethodWithFloat::19:1 +// CHECK: [19:40 - 19:41] ObjCInstanceMethodDecl=catMethodWithFloat::19:9 // CHECK: [19:41 - 20:1] ObjCCategoryDecl=FooCat:18:12 -// CHECK: [20:1 - 20:23] ObjCInstanceMethodDecl=floatMethod:20:1 +// CHECK: [20:1 - 20:23] ObjCInstanceMethodDecl=floatMethod:20:11 // CHECK: [20:23 - 21:5] ObjCCategoryDecl=FooCat:18:12 // CHECK: [21:5 - 23:1] Invalid Cursor => NoDeclFound // CHECK: [23:1 - 24:1] ObjCProtocolDecl=Proto:23:11 (Definition) -// CHECK: [24:1 - 24:11] ObjCInstanceMethodDecl=pMethod:24:1 +// CHECK: [24:1 - 24:11] ObjCInstanceMethodDecl=pMethod:24:3 // CHECK: [24:11 - 25:5] ObjCProtocolDecl=Proto:23:11 (Definition) // CHECK: [25:5 - 27:1] Invalid Cursor => NoDeclFound // CHECK: [27:1 - 27:17] ObjCProtocolDecl=SubP:27:11 (Definition) // CHECK: [27:17 - 27:22] ObjCProtocolRef=Proto:23:1 // CHECK: [27:22 - 28:1] ObjCProtocolDecl=SubP:27:11 (Definition) -// CHECK: [28:1 - 28:12] ObjCInstanceMethodDecl=spMethod:28:1 +// CHECK: [28:1 - 28:12] ObjCInstanceMethodDecl=spMethod:28:3 // CHECK: [28:12 - 29:5] ObjCProtocolDecl=SubP:27:11 (Definition) // CHECK: [29:5 - 31:1] Invalid Cursor => NoDeclFound // CHECK: [31:1 - 31:18] ObjCInterfaceDecl=Baz:31:12 @@ -118,18 +118,18 @@ void f() { // CHECK: [45:12 - 46:2] CompoundStmt= // CHECK: [46:2 - 46:4] TypeRef=id:0:0 // CHECK: [46:4 - 46:9] VarDecl=a:46:5 (Definition) -// CHECK: [46:9 - 46:10] ObjCMessageExpr=foo:7:1 +// CHECK: [46:9 - 46:10] ObjCMessageExpr=foo:7:3 // CHECK: [46:10 - 46:13] DeclRefExpr=bee:45:8 -// CHECK: [46:13 - 46:18] ObjCMessageExpr=foo:7:1 +// CHECK: [46:13 - 46:18] ObjCMessageExpr=foo:7:3 // CHECK: [46:18 - 46:19] DeclStmt= // CHECK: [46:19 - 47:2] CompoundStmt= // CHECK: [47:2 - 47:4] TypeRef=id:0:0 // CHECK: [47:4 - 47:6] VarDecl=c:47:12 (Definition) // CHECK: [47:6 - 47:10] ObjCProtocolRef=SubP:27:1 // CHECK: [47:10 - 47:16] VarDecl=c:47:12 (Definition) -// CHECK: [47:16 - 47:17] ObjCMessageExpr=fooC:8:1 +// CHECK: [47:16 - 47:17] ObjCMessageExpr=fooC:8:3 // CHECK: [47:17 - 47:20] ObjCClassRef=Foo:3:12 -// CHECK: [47:20 - 47:26] ObjCMessageExpr=fooC:8:1 +// CHECK: [47:20 - 47:26] ObjCMessageExpr=fooC:8:3 // CHECK: [47:26 - 47:27] DeclStmt= // CHECK: [47:27 - 48:2] CompoundStmt= // CHECK: [48:2 - 48:4] TypeRef=id:0:0 @@ -142,17 +142,17 @@ void f() { // CHECK: [49:3 - 49:6] BinaryOperator= // CHECK: [49:6 - 49:7] DeclRefExpr=c:47:12 // CHECK: [49:7 - 50:2] CompoundStmt= -// CHECK: [50:2 - 50:3] ObjCMessageExpr=pMethod:24:1 +// CHECK: [50:2 - 50:3] ObjCMessageExpr=pMethod:24:3 // CHECK: [50:3 - 50:4] DeclRefExpr=d:48:13 -// CHECK: [50:4 - 50:13] ObjCMessageExpr=pMethod:24:1 +// CHECK: [50:4 - 50:13] ObjCMessageExpr=pMethod:24:3 // CHECK: [50:13 - 51:2] CompoundStmt= -// CHECK: [51:2 - 51:3] ObjCMessageExpr=catMethodWithFloat::19:1 +// CHECK: [51:2 - 51:3] ObjCMessageExpr=catMethodWithFloat::19:9 // CHECK: [51:3 - 51:6] DeclRefExpr=bee:45:8 -// CHECK: [51:6 - 51:26] ObjCMessageExpr=catMethodWithFloat::19:1 +// CHECK: [51:6 - 51:26] ObjCMessageExpr=catMethodWithFloat::19:9 // CHECK: [51:26 - 51:27] ObjCMessageExpr=floatMethod:20:1 // CHECK: [51:27 - 51:30] DeclRefExpr=bee:45:8 // CHECK: [51:30 - 51:43] ObjCMessageExpr=floatMethod:20:1 -// CHECK: [51:43 - 51:44] ObjCMessageExpr=catMethodWithFloat::19:1 +// CHECK: [51:43 - 51:44] ObjCMessageExpr=catMethodWithFloat::19:9 // CHECK: [51:44 - 52:3] CompoundStmt= // CHECK: [52:3 - 52:7] DeclRefExpr=main:44:5 // CHECK: [52:7 - 52:8] CallExpr=main:44:5 diff --git a/test/Index/cindex-on-invalid-usrs.m b/test/Index/cindex-on-invalid-usrs.m index 01002bc30f3c..64147615ca51 100644 --- a/test/Index/cindex-on-invalid-usrs.m +++ b/test/Index/cindex-on-invalid-usrs.m @@ -4,4 +4,4 @@ @interface Rdar8452791 () - (void)rdar8452791; // CHECK: error: cannot find interface declaration for 'Rdar8452791' -// CHECK: missing @end +// CHECK: missing '@end' diff --git a/test/Index/complete-at-exprstmt.m b/test/Index/complete-at-exprstmt.m index 7532bbb14d71..a6d767529af5 100644 --- a/test/Index/complete-at-exprstmt.m +++ b/test/Index/complete-at-exprstmt.m @@ -31,9 +31,9 @@ void f() { // CHECK-CC2: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )} // CHECK-CC2: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )} // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:3 %s | FileCheck -check-prefix=CHECK-CC3 %s -// CHECK-CC3: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )} -// CHECK-CC3: NotImplemented:{TypedText @protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )} -// CHECK-CC3: NotImplemented:{TypedText @selector}{LeftParen (}{Placeholder selector}{RightParen )} +// CHECK-CC3: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )} +// CHECK-CC3: NotImplemented:{ResultType Protocol *}{TypedText @protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )} +// CHECK-CC3: NotImplemented:{ResultType SEL}{TypedText @selector}{LeftParen (}{Placeholder selector}{RightParen )} // CHECK-CC3: NotImplemented:{TypedText @synchronized}{HorizontalSpace }{LeftParen (}{Placeholder expression}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }} // CHECK-CC3: NotImplemented:{TypedText @throw}{HorizontalSpace }{Placeholder expression} // CHECK-CC3: NotImplemented:{TypedText @try}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @catch}{LeftParen (}{Placeholder parameter}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @finally}{LeftBrace {}{Placeholder statements}{RightBrace }} diff --git a/test/Index/complete-blocks.m b/test/Index/complete-blocks.m index e7919efb0eb8..cb507e2be34e 100644 --- a/test/Index/complete-blocks.m +++ b/test/Index/complete-blocks.m @@ -26,14 +26,22 @@ void test_B(B *b) { } @interface C -- method4:(void(^)(void))arg { }; -- method5:(void(^)())arg5 { }; +- method4:(void(^)(void))arg; +- method5:(void(^)())arg5; @end void test_C(C *c) { [c method4:^{}]; } +@interface D +- method6:(void(^)(block_t block))arg; +@end + +void test_D(D *d) { + [d method6:0]; +} + // RUN: c-index-test -code-completion-at=%s:8:1 %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: FunctionDecl:{ResultType void}{TypedText f}{LeftParen (}{Placeholder ^int(int x, int y)block}{RightParen )} (50) // CHECK-CC1: FunctionDecl:{ResultType void}{TypedText g}{LeftParen (}{Placeholder ^(float f, double d)b}{RightParen )} (50) @@ -51,3 +59,6 @@ void test_C(C *c) { // CHECK-CC5-NOT: test_A // CHECK-CC5: {TypedText union} (50) +// RUN: c-index-test -code-completion-at=%s:42:6 %s | FileCheck -check-prefix=CHECK-CC6 %s +// CHECK-CC6: ObjCInstanceMethodDecl:{ResultType id}{TypedText method6:}{Placeholder ^(block_t block)arg} (35) + diff --git a/test/Index/complete-cxx-inline-methods.cpp b/test/Index/complete-cxx-inline-methods.cpp index e25949df4cab..d441972dd6fe 100644 --- a/test/Index/complete-cxx-inline-methods.cpp +++ b/test/Index/complete-cxx-inline-methods.cpp @@ -1,3 +1,4 @@ +namespace { class MyCls { void in_foo() { vec.x = 0; @@ -12,8 +13,18 @@ void MyCls::out_foo() { vec.x = 0; } -// RUN: c-index-test -code-completion-at=%s:3:9 %s | FileCheck %s -// RUN: c-index-test -code-completion-at=%s:12:7 %s | FileCheck %s +class OtherClass : public MyCls { +public: + OtherClass(const OtherClass &other) : MyCls(other), value(value) { } + +private: + int value; + MyCls *object; +}; +} + +// RUN: c-index-test -code-completion-at=%s:4:9 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:13:7 %s | FileCheck %s // CHECK: CXXMethod:{ResultType MyCls::Vec &}{TypedText operator=}{LeftParen (}{Placeholder const MyCls::Vec &}{RightParen )} (34) // CHECK-NEXT: StructDecl:{TypedText Vec}{Text ::} (75) // CHECK-NEXT: FieldDecl:{ResultType int}{TypedText x} (35) @@ -22,3 +33,12 @@ void MyCls::out_foo() { // CHECK-NEXT: Completion contexts: // CHECK-NEXT: Dot member access // CHECK-NEXT: Container Kind: StructDecl + +// RUN: c-index-test -code-completion-at=%s:18:41 %s | FileCheck -check-prefix=CHECK-CTOR-INIT %s +// CHECK-CTOR-INIT: NotImplemented:{TypedText MyCls}{LeftParen (}{Placeholder args}{RightParen )} (7) +// CHECK-CTOR-INIT: MemberRef:{TypedText object}{LeftParen (}{Placeholder args}{RightParen )} (35) +// CHECK-CTOR-INIT: MemberRef:{TypedText value}{LeftParen (}{Placeholder args}{RightParen )} (35) +// RUN: c-index-test -code-completion-at=%s:18:55 %s | FileCheck -check-prefix=CHECK-CTOR-INIT-2 %s +// CHECK-CTOR-INIT-2-NOT: NotImplemented:{TypedText MyCls}{LeftParen (}{Placeholder args}{RightParen )} +// CHECK-CTOR-INIT-2: MemberRef:{TypedText object}{LeftParen (}{Placeholder args}{RightParen )} (35) +// CHECK-CTOR-INIT-2: MemberRef:{TypedText value}{LeftParen (}{Placeholder args}{RightParen )} (7) diff --git a/test/Index/complete-declarators.m b/test/Index/complete-declarators.m index 747da018af50..071df601b974 100644 --- a/test/Index/complete-declarators.m +++ b/test/Index/complete-declarators.m @@ -39,12 +39,12 @@ // CHECK-CC3-NOT: VarDecl:{ResultType int}{TypedText q2} // CHECK-CC3-NOT: VarDecl:{ResultType id}{TypedText q} // CHECK-CC3: NotImplemented:{ResultType A *}{TypedText self} (34) -// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) +// CHECK-CC3: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) // RUN: c-index-test -code-completion-at=%s:15:15 %s | FileCheck -check-prefix=CHECK-CC4 %s // CHECK-CC4: ParmDecl:{ResultType id}{TypedText param1} (34) // CHECK-CC4-NOT: VarDecl:{ResultType int}{TypedText q2} // CHECK-CC4: NotImplemented:{ResultType A *}{TypedText self} (34) -// CHECK-CC4: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) +// CHECK-CC4: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) // RUN: c-index-test -code-completion-at=%s:23:10 %s | FileCheck -check-prefix=CHECK-CC5 %s // CHECK-CC5: NotImplemented:{TypedText _Bool} (50) // CHECK-CC5: NotImplemented:{TypedText _Complex} (50) diff --git a/test/Index/complete-enums.c b/test/Index/complete-enums.c index 33a4cd42811c..713e24f798b7 100644 --- a/test/Index/complete-enums.c +++ b/test/Index/complete-enums.c @@ -1,22 +1,22 @@ // Note: the run lines follow their respective tests, since line/column // matter in this test. -enum Color { +enum __attribute__((deprecated)) Color { Color_Red = 17, Color_Green, Color_Blue }; int Greeby(); -void f(Color color) { +void f(enum Color color) { switch (color) { case Red: } } // RUN: c-index-test -code-completion-at=%s:11:1 %s | FileCheck -check-prefix=CHECK-CC1 %s -// CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Red} +// CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Red} (65) (deprecated) // RUN: c-index-test -code-completion-at=%s:12:8 %s | FileCheck -check-prefix=CHECK-CC2 %s -// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Blue} (7) -// CHECK-CC2-NEXT: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Green} (7) -// CHECK-CC2-NEXT: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Red} (7) +// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Blue} (7) (deprecated) +// CHECK-CC2-NEXT: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Green} (7) (deprecated) +// CHECK-CC2-NEXT: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Red} (7) (deprecated) diff --git a/test/Index/complete-enums.cpp b/test/Index/complete-enums.cpp new file mode 100644 index 000000000000..49a893258773 --- /dev/null +++ b/test/Index/complete-enums.cpp @@ -0,0 +1,25 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +enum class Color { + Red = 17, + Green, + Blue +}; +int Greeby(); +void f(Color color) { + switch (color) { + case Color::Green: + case Color::Red; + } +} + +// RUN: c-index-test -code-completion-at=%s:12:8 -std=c++11 %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Blue} (7) +// CHECK-CC1: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Green} (7) +// CHECK-CC1: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Red} (7) + +// RUN: c-index-test -code-completion-at=%s:13:8 -std=c++11 %s | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Blue} (7) +// CHECK-CC2-NOT: Green +// CHECK-CC2: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Red} (7) diff --git a/test/Index/complete-exprs.c b/test/Index/complete-exprs.c index aa22e776221e..afb6219ae303 100644 --- a/test/Index/complete-exprs.c +++ b/test/Index/complete-exprs.c @@ -31,7 +31,7 @@ void f5(float f) { // CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (12) (unavailable) // CHECK-CC1-NOT: NotImplemented:{TypedText float} (65) // CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (8) -// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) +// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s // RUN: c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s @@ -39,7 +39,7 @@ void f5(float f) { // CHECK-CC3: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50) // CHECK-CC3-NOT: NotImplemented:{TypedText float} // CHECK-CC3: ParmDecl:{ResultType int}{TypedText j} (34) -// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expressio +// CHECK-CC3: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expressio // RUN: c-index-test -code-completion-at=%s:7:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s // RUN: c-index-test -code-completion-at=%s:7:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s @@ -48,7 +48,7 @@ void f5(float f) { // CHECK-CC2: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50) // CHECK-CC2: NotImplemented:{TypedText float} (50) // CHECK-CC2: ParmDecl:{ResultType int}{TypedText j} (34) -// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) +// CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) // RUN: c-index-test -code-completion-at=%s:11:16 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s // CHECK-CC4: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50) // CHECK-CC4: VarDecl:{ResultType struct X}{TypedText f1} (50) (deprecated) diff --git a/test/Index/complete-exprs.cpp b/test/Index/complete-exprs.cpp index a8100653b2aa..de3aac52c02d 100644 --- a/test/Index/complete-exprs.cpp +++ b/test/Index/complete-exprs.cpp @@ -26,8 +26,30 @@ void g() { vector<int>(foo(), foo()); } -// RUN: c-index-test -code-completion-at=%s:20:2 %s | FileCheck -check-prefix=CHECK-CC1 %s -// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:20:2 %s | FileCheck -check-prefix=CHECK-CC1 %s +struct X { + void f() const; +}; + +void X::f() const { + +} + +namespace N { + int x; + class C { + int member; + + int f(int param) { + return member; + } + }; +} + +// RUN: c-index-test -code-completion-at=%s:20:2 %s -std=c++0x | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:20:2 -std=c++0x %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText alignof}{LeftParen (}{Placeholder type}{RightParen )} (40) +// CHECK-CC1: NotImplemented:{ResultType bool}{TypedText noexcept}{LeftParen (}{Placeholder expression}{RightParen )} (40) +// CHECK-CC1: NotImplemented:{ResultType std::nullptr_t}{TypedText nullptr} (40) // CHECK-CC1: NotImplemented:{TypedText operator} (40) // CHECK-CC1-NOT: push_back // CHECK-CC1: ClassDecl:{TypedText string} (50) @@ -51,3 +73,12 @@ void g() { // CHECK-CC3: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50) // CHECK-CC3: CXXConstructor:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder const T &}{Comma , }{Placeholder unsigned int n}{RightParen )} (50) // CHECK-CC3: FunctionTemplate:{ResultType void}{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder InputIterator first}{Comma , }{Placeholder InputIterator last}{RightParen )} (50) + +// RUN: c-index-test -code-completion-at=%s:34:1 %s -std=c++0x | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: NotImplemented:{ResultType const X *}{TypedText this} (40) + +// RUN: c-index-test -code-completion-at=%s:43:14 %s | FileCheck -check-prefix=CHECK-CC5 %s +// CHECK-CC5: FieldDecl:{ResultType int}{TypedText member} (8) (parent: ClassDecl 'N::C') +// CHECK-CC5: ParmDecl:{ResultType int}{TypedText param} (8) +// CHECK-CC5: StructDecl:{TypedText X} (50) (parent: TranslationUnit '(null)') +// CHECK-CC5: VarDecl:{ResultType int}{TypedText x} (12) (parent: Namespace 'N') diff --git a/test/Index/complete-exprs.m b/test/Index/complete-exprs.m index 08ec019003f3..c3ff63bdbda6 100644 --- a/test/Index/complete-exprs.m +++ b/test/Index/complete-exprs.m @@ -2,9 +2,9 @@ typedef signed char BOOL; #define YES ((BOOL)1) #define NO ((BOOL)0) #define bool _Bool +@interface NSArray + (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt; @end @interface A - (int)method:(id)param1; - @property int prop1; @end __strong id global; @@ -12,10 +12,14 @@ __strong id global; - (int)method:(id)param1 { void foo(bool (^block)(id x, A* y)); for(BOOL B = YES; ; ) { } + @[ global ]; + @{ global : global }; } @end // RUN: c-index-test -code-completion-at=%s:13:2 %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: NotImplemented:{TypedText @[}{HorizontalSpace }{Placeholder objects, ...}{HorizontalSpace }{RightBracket ]} (40) +// CHECK-CC1: NotImplemented:{TypedText @{}{HorizontalSpace }{Placeholder key}{HorizontalSpace }{Colon :}{HorizontalSpace }{Placeholder object, ...}{HorizontalSpace }{RightBrace }} (40) // CHECK-CC1: NotImplemented:{ResultType SEL}{TypedText _cmd} (80) // CHECK-CC1: TypedefDecl:{TypedText BOOL} (50) // CHECK-CC1: macro definition:{TypedText bool} (51) @@ -26,9 +30,20 @@ __strong id global; // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:7 %s | FileCheck -check-prefix=CHECK-CC2 %s // CHECK-CC2: TypedefDecl:{TypedText BOOL} (50) // CHECK-CC2: NotImplemented:{TypedText char} (50) -// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) +// CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) // RUN: c-index-test -code-completion-at=%s:15:1 -fobjc-arc -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC3 %s // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:15:1 -fobjc-arc -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC3 %s // CHECK-CC3: FunctionDecl:{ResultType void}{TypedText foo}{LeftParen (}{Placeholder ^bool(id x, A *y)block}{RightParen )} (34) // CHECK-CC3: VarDecl:{ResultType id}{TypedText global} (50) // CHECK-CC3: ParmDecl:{ResultType id}{TypedText param1} (34) + +// RUN: c-index-test -code-completion-at=%s:15:5 %s | FileCheck -check-prefix=CHECK-CC4 %s +// RUN: c-index-test -code-completion-at=%s:16:5 %s | FileCheck -check-prefix=CHECK-CC4 %s +// RUN: c-index-test -code-completion-at=%s:16:14 %s | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: NotImplemented:{TypedText @[}{HorizontalSpace }{Placeholder objects, ...}{HorizontalSpace }{RightBracket ]} (40) +// CHECK-CC4: NotImplemented:{TypedText @{}{HorizontalSpace }{Placeholder key}{HorizontalSpace }{Colon :}{HorizontalSpace }{Placeholder object, ...}{HorizontalSpace }{RightBrace }} (40) +// CHECK-CC4: NotImplemented:{ResultType SEL}{TypedText _cmd} (80) +// CHECK-CC4: macro definition:{TypedText bool} (51) +// CHECK-CC4: macro definition:{TypedText NO} (65) +// CHECK-CC4: NotImplemented:{ResultType A *}{TypedText self} (34) +// CHECK-CC4: macro definition:{TypedText YES} (65) diff --git a/test/Index/complete-in-invalid-method.m b/test/Index/complete-in-invalid-method.m new file mode 100644 index 000000000000..0e6c8e664ce6 --- /dev/null +++ b/test/Index/complete-in-invalid-method.m @@ -0,0 +1,19 @@ +@interface I +-(void)foo; +@end + +struct S { + int x,y; +}; + +@implementation I +-(void) foo { + struct S s; + if (1) { + s. +} +@end + +// RUN: c-index-test -code-completion-at=%s:13:7 -fobjc-nonfragile-abi %s | FileCheck %s +// CHECK: FieldDecl:{ResultType int}{TypedText x} +// CHECK: FieldDecl:{ResultType int}{TypedText y} diff --git a/test/Index/complete-ivar-access.m b/test/Index/complete-ivar-access.m new file mode 100644 index 000000000000..13b43d868aeb --- /dev/null +++ b/test/Index/complete-ivar-access.m @@ -0,0 +1,69 @@ +@interface Other { +@private + int other_private; +@protected + int other_protected; +@public + int other_public; +} +@end + +@interface Super { +@private + int super_private; +@protected + int super_protected; +@public + int super_public; +} +@end + +@interface Super () { +@private + int super_ext_private; +@protected + int super_ext_protected; +@public + int super_ext_public; +} +@end + +@interface Sub : Super { +@private + int sub_private; +@protected + int sub_protected; +@public + int sub_public; +} +@end + +@implementation Sub +- (void)method:(Sub *)sub with:(Other *)other { + sub->super_protected = 1; + other->other_public = 1; +} + +void f(Sub *sub, Other *other) { + sub->super_protected = 1; + other->other_public = 1; +} +@end + +// RUN: c-index-test -code-completion-at=%s:43:8 -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-SUB %s +// RUN: c-index-test -code-completion-at=%s:48:8 -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-SUB %s +// CHECK-SUB: ObjCIvarDecl:{ResultType int}{TypedText sub_private} (35) +// CHECK-SUB: ObjCIvarDecl:{ResultType int}{TypedText sub_protected} (35) +// CHECK-SUB: ObjCIvarDecl:{ResultType int}{TypedText sub_public} (35) +// CHECK-SUB: ObjCIvarDecl:{ResultType int}{TypedText super_ext_private} (35) (inaccessible) +// CHECK-SUB: ObjCIvarDecl:{ResultType int}{TypedText super_ext_protected} (35) +// CHECK-SUB: ObjCIvarDecl:{ResultType int}{TypedText super_ext_public} (35) +// CHECK-SUB: ObjCIvarDecl:{ResultType int}{TypedText super_private} (37) (inaccessible) +// CHECK-SUB: ObjCIvarDecl:{ResultType int}{TypedText super_protected} (37) +// CHECK-SUB: ObjCIvarDecl:{ResultType int}{TypedText super_public} (37) + +// RUN: c-index-test -code-completion-at=%s:44:10 -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-OTHER %s +// RUN: c-index-test -code-completion-at=%s:49:10 -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-OTHER %s +// CHECK-OTHER: ObjCIvarDecl:{ResultType int}{TypedText other_private} (35) (inaccessible) +// CHECK-OTHER: ObjCIvarDecl:{ResultType int}{TypedText other_protected} (35) (inaccessible) +// CHECK-OTHER: ObjCIvarDecl:{ResultType int}{TypedText other_public} (35) diff --git a/test/Index/complete-lambdas.cpp b/test/Index/complete-lambdas.cpp new file mode 100644 index 000000000000..ba337e45d3a0 --- /dev/null +++ b/test/Index/complete-lambdas.cpp @@ -0,0 +1,43 @@ +// This test is line- and column-sensitive. See below for run lines. + +int global; + +struct X { + static int member; + void f(int zed) { + int local; + static int local_static; + [=] { + int inner_local; + [local, this, inner_local] { + } + }(); + } +}; + + +// RUN: c-index-test -code-completion-at=%s:12:8 -std=c++11 %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: VarDecl:{ResultType int}{TypedText inner_local} (34) +// CHECK-CC1-NEXT: VarDecl:{ResultType int}{TypedText local} (34) +// CHECK-CC1-NEXT: NotImplemented:{ResultType X *}{TypedText this} (40) +// CHECK-CC1-NEXT: ParmDecl:{ResultType int}{TypedText zed} (34) + +// RUN: c-index-test -code-completion-at=%s:12:15 -std=c++11 %s | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: VarDecl:{ResultType int}{TypedText inner_local} (34) +// CHECK-CC2-NEXT: NotImplemented:{ResultType X *}{TypedText this} (40) +// CHECK-CC2-NEXT: ParmDecl:{ResultType int}{TypedText zed} (34) + +// RUN: c-index-test -code-completion-at=%s:12:21 -std=c++11 %s | FileCheck -check-prefix=CHECK-CC3 %s +// CHECK-CC3: VarDecl:{ResultType int}{TypedText inner_local} (34) +// CHECK-CC3-NEXT: ParmDecl:{ResultType int}{TypedText zed} (34) + +// RUN: c-index-test -code-completion-at=%s:12:8 -x objective-c++ -std=c++11 %s | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: TypedefDecl:{TypedText Class} (50) +// CHECK-CC4: TypedefDecl:{TypedText id} (50) +// CHECK-CC4: VarDecl:{ResultType int}{TypedText inner_local} (34) +// CHECK-CC4: VarDecl:{ResultType int}{TypedText local} (34) +// CHECK-CC4: NotImplemented:{ResultType X *}{TypedText this} (40) +// CHECK-CC4: ParmDecl:{ResultType int}{TypedText zed} (34) + +// RUN: c-index-test -code-completion-at=%s:12:15 -x objective-c++ -std=c++11 %s | FileCheck -check-prefix=CHECK-CC2 %s +// RUN: c-index-test -code-completion-at=%s:12:21 -x objective-c++ -std=c++11 %s | FileCheck -check-prefix=CHECK-CC3 %s diff --git a/test/Index/complete-macros.c b/test/Index/complete-macros.c index f1c1346a7db8..df798a8477f6 100644 --- a/test/Index/complete-macros.c +++ b/test/Index/complete-macros.c @@ -19,6 +19,7 @@ void f2() { #define variadic2(args...) #define variadic3(args, ...) #define variadic4(first, second, args, ...) +#define variadic5(first, second, args ...) void test_variadic() { @@ -34,8 +35,9 @@ void test_variadic() { // RUN: c-index-test -code-completion-at=%s:15:5 %s | FileCheck -check-prefix=CHECK-CC3 %s // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:15:5 %s | FileCheck -check-prefix=CHECK-CC3 %s // CHECK-CC3: macro definition:{TypedText nil} (65) -// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:24:2 %s | FileCheck -check-prefix=CHECK-VARIADIC %s +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:25:2 %s | FileCheck -check-prefix=CHECK-VARIADIC %s // CHECK-VARIADIC: macro definition:{TypedText variadic1}{LeftParen (}{Placeholder ...}{RightParen )} (70) // CHECK-VARIADIC: macro definition:{TypedText variadic2}{LeftParen (}{Placeholder args...}{RightParen )} (70) // CHECK-VARIADIC: macro definition:{TypedText variadic3}{LeftParen (}{Placeholder args, ...}{RightParen )} (70) -// CHECK-VARIADIC: macro definition:{TypedText variadic4}{LeftParen (}{Placeholder first}{Comma , }{Placeholder second...}{Placeholder first, second...}{RightParen )} (70) +// CHECK-VARIADIC: macro definition:{TypedText variadic4}{LeftParen (}{Placeholder first}{Comma , }{Placeholder second}{Comma , }{Placeholder args, ...}{RightParen )} (70) +// CHECK-VARIADIC: macro definition:{TypedText variadic5}{LeftParen (}{Placeholder first}{Comma , }{Placeholder second}{Comma , }{Placeholder args...}{RightParen )} (70) diff --git a/test/Index/complete-member-access.m b/test/Index/complete-member-access.m index 48156d93ffba..5e40be1eac01 100644 --- a/test/Index/complete-member-access.m +++ b/test/Index/complete-member-access.m @@ -34,6 +34,14 @@ int test_more_props(Sub *s) { return s.myOtherPropLikeThing; } +@interface Other +@property Sub *sub; +@end + +int test_two_levels(Other *other) { + return other.sub.myProp; +} + // RUN: c-index-test -code-completion-at=%s:21:7 %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText prop1} // CHECK-CC1: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp} @@ -59,4 +67,11 @@ int test_more_props(Sub *s) { // CHECK-CC3-NEXT: Objective-C property access // CHECK-CC3-NEXT: Container Kind: ObjCInterfaceDecl // CHECK-CC3-NEXT: Container is complete -// CHECK-CC3-NEXT: Container USR: c:objc(cs)Sub
\ No newline at end of file +// CHECK-CC3-NEXT: Container USR: c:objc(cs)Sub + +// RUN: c-index-test -code-completion-at=%s:42:20 %s | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText myOtherPropLikeThing} (37) +// CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText myProp} (35) +// CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText prop1} (35) +// CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp} (35) + diff --git a/test/Index/complete-method-decls.m b/test/Index/complete-method-decls.m index 2ab119795347..becb7de6eb8b 100644 --- a/test/Index/complete-method-decls.m +++ b/test/Index/complete-method-decls.m @@ -4,7 +4,7 @@ @protocol P1 - (id)abc; - (id)initWithInt:(int)x; -- (id)initWithTwoInts:(int)x second:(int)y; +- (id)initWithTwoInts:(inout int)x second:(int)y; - (int)getInt; - (id)getSelf; @end @@ -57,7 +57,7 @@ @end @interface Passing -- (oneway void)method:(in id x); +- (oneway void)method:(in id)x; @end @interface Gaps @@ -65,44 +65,48 @@ @end @implementation Gaps -- (void)method:(int)x :(int)y; +- (void)method:(int)x :(int)y {} +@end + +@implementation Passing +- (oneway void)method:(in id x) {} @end // RUN: c-index-test -code-completion-at=%s:17:3 %s | FileCheck -check-prefix=CHECK-CC1 %s -// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText abc} -// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText getInt} -// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf} -// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x} -// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y} +// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText abc} (40) (parent: ObjCProtocolDecl 'P1') +// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText getInt} (40) (parent: ObjCProtocolDecl 'P1') +// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf} (40) (parent: ObjCProtocolDecl 'P1') +// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x} (40) (parent: ObjCProtocolDecl 'P1') +// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text inout }{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y} (40) (parent: ObjCProtocolDecl 'P1') // RUN: c-index-test -code-completion-at=%s:17:7 %s | FileCheck -check-prefix=CHECK-CC2 %s // CHECK-CC2: ObjCInstanceMethodDecl:{TypedText abc} // CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{TypedText getSelf} // CHECK-CC2: ObjCInstanceMethodDecl:{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x} -// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y} +// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text inout }{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y} // RUN: c-index-test -code-completion-at=%s:24:7 %s | FileCheck -check-prefix=CHECK-CC3 %s // CHECK-CC3: ObjCInstanceMethodDecl:{TypedText abc} // CHECK-CC3-NEXT: ObjCInstanceMethodDecl:{TypedText getSelf} // CHECK-CC3: ObjCInstanceMethodDecl:{TypedText init} // CHECK-CC3: ObjCInstanceMethodDecl:{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x} -// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y} +// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text inout }{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y} // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:33:3 %s | FileCheck -check-prefix=CHECK-CC4 %s // CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (42) // CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText getInt}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText getSecondValue}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (40) // CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace -// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace +// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text inout }{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText setValue}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:33:8 %s | FileCheck -check-prefix=CHECK-CC5 %s -// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText getInt}{HorizontalSpace }{LeftBrace {}{VerticalSpace -// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText getSecondValue}{HorizontalSpace }{LeftBrace {}{VerticalSpace +// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText getInt}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (42) (parent: ObjCProtocolDecl 'P1') +// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText getSecondValue}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (40) (parent: ObjCInterfaceDecl 'B') // CHECK-CC5-NOT: {TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC5: ObjCInstanceMethodDecl:{TypedText setValue}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:37:7 %s | FileCheck -check-prefix=CHECK-CC6 %s // CHECK-CC6: ObjCInstanceMethodDecl:{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace // CHECK-CC6: ObjCInstanceMethodDecl:{TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (40) // CHECK-CC6: ObjCInstanceMethodDecl:{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace -// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace +// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text inout }{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:42:3 %s | FileCheck -check-prefix=CHECK-CC7 %s // CHECK-CC7: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (42) // CHECK-CC7: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText categoryFunction}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace @@ -174,3 +178,7 @@ // <rdar://problem/8939352> // RUN: c-index-test -code-completion-at=%s:68:9 %s | FileCheck -check-prefix=CHECK-8939352 %s // CHECK-8939352: ObjCInstanceMethodDecl:{TypedText method}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text y} (40) + + +// RUN: c-index-test -code-completion-at=%s:72:2 %s | FileCheck -check-prefix=CHECK-ONEWAY %s +// CHECK-ONEWAY: ObjCInstanceMethodDecl:{LeftParen (}{Text oneway }{Text void}{RightParen )}{TypedText method}{TypedText :}{LeftParen (}{Text in }{Text id}{RightParen )}{Text x} (40) (parent: ObjCInterfaceDecl 'Passing') diff --git a/test/Index/complete-modules.m b/test/Index/complete-modules.m new file mode 100644 index 000000000000..b82430db9dbb --- /dev/null +++ b/test/Index/complete-modules.m @@ -0,0 +1,14 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +@__experimental_modules_import LibA.Extensions; + +// RUN: rm -rf %t +// RUN: c-index-test -code-completion-at=%s:4:32 -fmodule-cache-path %t -fmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-TOP-LEVEL %s +// CHECK-TOP-LEVEL: NotImplemented:{TypedText Framework} (50) +// CHECK-TOP-LEVEL: NotImplemented:{TypedText LibA} (50) +// CHECK-TOP-LEVEL: NotImplemented:{TypedText nested} (50) + +// RUN: c-index-test -code-completion-at=%s:4:37 -fmodule-cache-path %t -fmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-LIBA %s +// CHECK-LIBA: NotImplemented:{TypedText Extensions} (50) + diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m index 955ab6f144f9..1835c3edc55e 100644 --- a/test/Index/complete-objc-message.m +++ b/test/Index/complete-objc-message.m @@ -190,11 +190,11 @@ void test_DO(DO *d, A* a) { } // RUN: c-index-test -code-completion-at=%s:23:19 %s | FileCheck -check-prefix=CHECK-CC1 %s -// CHECK-CC1: {TypedText categoryClassMethod} -// CHECK-CC1: {TypedText classMethod1:}{Placeholder (id)}{HorizontalSpace }{TypedText withKeyword:}{Placeholder (int)} -// CHECK-CC1: {TypedText classMethod2} -// CHECK-CC1: {TypedText new} -// CHECK-CC1: {TypedText protocolClassMethod} +// CHECK-CC1: {TypedText categoryClassMethod} (35) (parent: ObjCCategoryDecl 'Foo(FooTestCategory)') +// CHECK-CC1: {TypedText classMethod1:}{Placeholder (id)}{HorizontalSpace }{TypedText withKeyword:}{Placeholder (int)} (35) (parent: ObjCInterfaceDecl 'Foo') +// CHECK-CC1: {TypedText classMethod2} (35) (parent: ObjCInterfaceDecl 'Foo') +// CHECK-CC1: {TypedText new} (35) (parent: ObjCInterfaceDecl 'Foo') +// CHECK-CC1: {TypedText protocolClassMethod} (37) (parent: ObjCProtocolDecl 'FooTestProtocol') // CHECK-CC1: Completion contexts: // CHECK-CC1-NEXT: Objective-C class method // CHECK-CC1-NEXT: Container Kind: ObjCInterfaceDecl @@ -309,7 +309,7 @@ void test_DO(DO *d, A* a) { // RUN: c-index-test -code-completion-at=%s:170:16 %s | FileCheck -check-prefix=CHECK-CLASS-RESULT %s // CHECK-CLASS-RESULT: ObjCClassMethodDecl:{ResultType void}{TypedText class_method3} (35) -// CHECK-CLASS-RESULT: ObjCClassMethodDecl:{ResultType void}{TypedText class_method4} (35) +// CHECK-CLASS-RESULT: ObjCClassMethodDecl:{ResultType void}{TypedText class_method4} (35) (parent: ObjCCategoryDecl 'A(Cat)') // RUN: c-index-test -code-completion-at=%s:181:4 %s | FileCheck -check-prefix=CHECK-BLOCK-RECEIVER %s // CHECK-BLOCK-RECEIVER: ObjCInterfaceDecl:{TypedText A} (50) @@ -333,4 +333,4 @@ void test_DO(DO *d, A* a) { // RUN: c-index-test -code-completion-at=%s:175:12 %s | FileCheck -check-prefix=CHECK-CLASS-RESULT %s // RUN: c-index-test -code-completion-at=%s:189:6 %s | FileCheck -check-prefix=CHECK-DISTRIB-OBJECTS %s -// CHECK-DISTRIB-OBJECTS: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (in bycopyA *)}{HorizontalSpace }{TypedText result:}{Placeholder (out byrefA **)} (35) +// CHECK-DISTRIB-OBJECTS: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (in bycopy A *)}{HorizontalSpace }{TypedText result:}{Placeholder (out byref A **)} (35) diff --git a/test/Index/complete-qualified.cpp b/test/Index/complete-qualified.cpp index 20f5105a8c1c..f5c032c23d0b 100644 --- a/test/Index/complete-qualified.cpp +++ b/test/Index/complete-qualified.cpp @@ -14,7 +14,7 @@ void foo() Foo:: // RUN: c-index-test -code-completion-at=%s:14:8 %s -o - | FileCheck -check-prefix=CC1 %s -// CHECK-CC1: FieldDecl:{ResultType C<Foo, class Bar>}{TypedText c} (35) -// CHECK-CC1: ClassDecl:{TypedText Foo} (35) -// CHECK-CC1: CXXMethod:{ResultType Foo &}{TypedText operator=}{LeftParen (}{Placeholder const Foo &}{RightParen )} (35) -// CHECK-CC1: CXXDestructor:{ResultType void}{TypedText ~Foo}{LeftParen (}{RightParen )} (35) +// CHECK-CC1: FieldDecl:{ResultType C<Foo, class Bar>}{TypedText c} (35) (parent: ClassDecl 'Foo') +// CHECK-CC1: ClassDecl:{TypedText Foo} (35) (parent: ClassDecl 'Foo') +// CHECK-CC1: CXXMethod:{ResultType Foo &}{TypedText operator=}{LeftParen (}{Placeholder const Foo &}{RightParen )} (35) (parent: ClassDecl 'Foo') +// CHECK-CC1: CXXDestructor:{ResultType void}{TypedText ~Foo}{LeftParen (}{RightParen )} (35) (parent: ClassDecl 'Foo') diff --git a/test/Index/complete-recovery.m b/test/Index/complete-recovery.m index 9300a7999217..19de0fbfc41e 100644 --- a/test/Index/complete-recovery.m +++ b/test/Index/complete-recovery.m @@ -18,16 +18,19 @@ // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:20 %s 2>%t | FileCheck -check-prefix=CHECK-CC1 %s // RUN: not grep error %t -// CHECK-CC1: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )} +// CHECK-CC1: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )} // CHECK-CC1-NOT: NotImplemented:{TypedText _Bool} // CHECK-CC1: VarDecl:{ResultType A *}{TypedText a} -// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} +// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} + +// Test case for fix comitted in r145441. +// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:20 %s -fms-compatibility | FileCheck -check-prefix=CHECK-CC1 %s // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:24 %s | FileCheck -check-prefix=CHECK-CC2 %s -// CHECK-CC2: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )} +// CHECK-CC2: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )} // CHECK-CC2: NotImplemented:{TypedText _Bool} // CHECK-CC2: VarDecl:{ResultType A *}{TypedText a} -// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} +// CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:12:11 %s | FileCheck -check-prefix=CHECK-CC3 %s // CHECK-CC3: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (int)} (32) // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:13:22 %s | FileCheck -check-prefix=CHECK-CC3 %s diff --git a/test/Index/complete-stmt.c b/test/Index/complete-stmt.c index 98fa9df44db3..e39431ebdcc8 100644 --- a/test/Index/complete-stmt.c +++ b/test/Index/complete-stmt.c @@ -7,6 +7,10 @@ void f(int x) { } } -// RUN: c-index-test -code-completion-at=%s:7:4 %s | FileCheck -check-prefix=CHECK-IF-ELSE %s +// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:7:4 %s | FileCheck -check-prefix=CHECK-IF-ELSE %s // CHECK-IF-ELSE: NotImplemented:{TypedText else}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Placeholder statements}{VerticalSpace }{RightBrace }} (40) // CHECK-IF-ELSE: NotImplemented:{TypedText else}{HorizontalSpace }{Text if}{HorizontalSpace }{LeftParen (}{Placeholder expression}{RightParen )}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Placeholder statements}{VerticalSpace }{RightBrace }} (40) + +// RUN: c-index-test -code-completion-at=%s:7:4 %s | FileCheck -check-prefix=CHECK-IF-ELSE-SIMPLE %s +// CHECK-IF-ELSE-SIMPLE: NotImplemented:{TypedText else} (40) +// CHECK-IF-ELSE-SIMPLE: NotImplemented:{TypedText else}{HorizontalSpace }{Text if}{HorizontalSpace }{LeftParen (}{Placeholder expression}{RightParen )} (40) diff --git a/test/Index/complete-super.cpp b/test/Index/complete-super.cpp index 71c22ad00d1e..9ffa7c8a4056 100644 --- a/test/Index/complete-super.cpp +++ b/test/Index/complete-super.cpp @@ -31,3 +31,12 @@ void B::bar(float real) { // RUN: c-index-test -code-completion-at=%s:16:6 %s | FileCheck -check-prefix=CHECK-FOO-QUAL %s // CHECK-FOO-QUAL: CXXMethod:{TypedText foo}{LeftParen (}{Placeholder a}{Comma , }{Placeholder b}{RightParen )} (20) +// RUN: c-index-test -code-completion-at=%s:5:1 %s | FileCheck -check-prefix=CHECK-ACCESS %s +// CHECK-ACCESS: NotImplemented:{TypedText private} (40) +// CHECK-ACCESS: NotImplemented:{TypedText protected} (40) +// CHECK-ACCESS: NotImplemented:{TypedText public} (40) + +// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:5:1 %s | FileCheck -check-prefix=CHECK-ACCESS-PATTERN %s +// CHECK-ACCESS-PATTERN: NotImplemented:{TypedText private}{Colon :} (40) +// CHECK-ACCESS-PATTERN: NotImplemented:{TypedText protected}{Colon :} (40) +// CHECK-ACCESS-PATTERN: NotImplemented:{TypedText public}{Colon :} (40) diff --git a/test/Index/complete-synthesized.m b/test/Index/complete-synthesized.m index 81f1ba186f1d..8c848fc18b51 100644 --- a/test/Index/complete-synthesized.m +++ b/test/Index/complete-synthesized.m @@ -35,12 +35,12 @@ } @end -// RUN: c-index-test -code-completion-at=%s:24:1 -fobjc-nonfragile-abi -fobjc-default-synthesize-properties %s | FileCheck %s -// RUN: c-index-test -code-completion-at=%s:30:2 -fobjc-nonfragile-abi -fobjc-default-synthesize-properties %s | FileCheck %s -// RUN: c-index-test -code-completion-at=%s:34:2 -fobjc-nonfragile-abi -fobjc-default-synthesize-properties %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:24:1 -target x86_64-apple-macosx10.7 -fobjc-nonfragile-abi %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:30:2 -target x86_64-apple-macosx10.7 -fobjc-nonfragile-abi %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:34:2 -target x86_64-apple-macosx10.7 -fobjc-nonfragile-abi %s | FileCheck %s // CHECK: NotImplemented:{TypedText _Bool} (50) // CHECK: ObjCIvarDecl:{ResultType float}{TypedText _prop2} (35) // CHECK-NOT: prop2 // CHECK-NOT: prop3 -// CHECK: ObjCIvarDecl:{ResultType double}{TypedText _prop4} (37) +// CHECK: ObjCIvarDecl:{ResultType double}{TypedText _prop4} (35) diff --git a/test/Index/complete-type-factors.m b/test/Index/complete-type-factors.m index b7bafb46712b..e5aa893eaabf 100644 --- a/test/Index/complete-type-factors.m +++ b/test/Index/complete-type-factors.m @@ -44,7 +44,7 @@ void test2(A *a) { // CHECK-CC1: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (32) // CHECK-CC1: ParmDecl:{ResultType enum Priority}{TypedText priority} (17) // CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (32) -// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) +// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) // CHECK-CC1: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (25) // RUN: c-index-test -code-completion-at=%s:17:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s // CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (16) @@ -59,7 +59,7 @@ void test2(A *a) { // CHECK-CC2: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65) // CHECK-CC2: ParmDecl:{ResultType enum Priority}{TypedText priority} (34) // CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16) -// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) +// CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) // CHECK-CC2: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50) // RUN: c-index-test -code-completion-at=%s:18:10 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s // CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (65) @@ -75,7 +75,7 @@ void test2(A *a) { // CHECK-CC3: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (16) // CHECK-CC3: ParmDecl:{ResultType enum Priority}{TypedText priority} (8) // CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (65) -// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) +// CHECK-CC3: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) // CHECK-CC3: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (12) // RUN: c-index-test -code-completion-at=%s:19:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s // CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (16) @@ -91,7 +91,7 @@ void test2(A *a) { // CHECK-CC4: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65) // CHECK-CC4: ParmDecl:{ResultType enum Priority}{TypedText priority} (34) // CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16) -// CHECK-CC4: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) +// CHECK-CC4: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) // CHECK-CC4: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50) // RUN: c-index-test -code-completion-at=%s:21:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s // RUN: c-index-test -code-completion-at=%s:22:7 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s @@ -109,7 +109,7 @@ void test2(A *a) { // CHECK-CC6: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65) // CHECK-CC6: ParmDecl:{ResultType enum Priority}{TypedText priority} (34) // CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16) -// CHECK-CC6: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) +// CHECK-CC6: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40) // CHECK-CC6: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50) // RUN: c-index-test -code-completion-at=%s:31:13 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s // RUN: c-index-test -code-completion-at=%s:32:13 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s diff --git a/test/Index/crash-recovery-code-complete.c b/test/Index/crash-recovery-code-complete.c index 9cad985364f8..dde90bc60ece 100644 --- a/test/Index/crash-recovery-code-complete.c +++ b/test/Index/crash-recovery-code-complete.c @@ -3,9 +3,10 @@ // RUN: "-remap-file=%s;%S/Inputs/crash-recovery-code-complete-remap.c" \ // RUN: %s 2> %t.err // RUN: FileCheck < %t.err -check-prefix=CHECK-CODE-COMPLETE-CRASH %s -// RUN: rm %t-preamble.pch +// RUN: test ! -e %t-preamble.pch // CHECK-CODE-COMPLETE-CRASH: Unable to perform code completion! // // REQUIRES: crash-recovery +// REQUIRES: shell #warning parsing original file diff --git a/test/Index/crash-recovery-modules.m b/test/Index/crash-recovery-modules.m new file mode 100644 index 000000000000..212923f94be6 --- /dev/null +++ b/test/Index/crash-recovery-modules.m @@ -0,0 +1,20 @@ +// Clear out the module cache entirely, so we start from nothing. +// RUN: rm -rf %t + +// Parse the file, such that building the module will cause Clang to crash. +// RUN: not env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all -fmodules -fmodule-cache-path %t -Xclang -fdisable-module-hash -I %S/Inputs/Headers -DCRASH %s 2> %t.err +// RUN: FileCheck < %t.err -check-prefix=CHECK-CRASH %s +// CHECK-CRASH: crash-recovery-modules.m:16:32:{16:2-16:37}: fatal error: could not build module 'Crash' + +// Parse the file again, without crashing, to make sure that +// subsequent parses do the right thing. +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all -fmodules -fmodule-cache-path %t -Xclang -fdisable-module-hash -I %S/Inputs/Headers %s + +// REQUIRES: crash-recovery +// REQUIRES: shell + +@__experimental_modules_import Crash; + +void test() { + const char* error = getCrashString(); +} diff --git a/test/Index/crash-recovery-reparse.c b/test/Index/crash-recovery-reparse.c index 243a914ec40d..06bb76b7f251 100644 --- a/test/Index/crash-recovery-reparse.c +++ b/test/Index/crash-recovery-reparse.c @@ -3,9 +3,10 @@ // RUN: -remap-file="%s;%S/Inputs/crash-recovery-reparse-remap.c" \ // RUN: %s 2> %t.err // RUN: FileCheck < %t.err -check-prefix=CHECK-REPARSE-SOURCE-CRASH %s -// RUN: rm %t-preamble.pch +// RUN: test ! -e $t-preamble.pch // CHECK-REPARSE-SOURCE-CRASH: Unable to reparse translation unit // // REQUIRES: crash-recovery +// REQUIRES: shell #warning parsing original file diff --git a/test/Index/cxx11-lambdas.cpp b/test/Index/cxx11-lambdas.cpp new file mode 100644 index 000000000000..93db0220359a --- /dev/null +++ b/test/Index/cxx11-lambdas.cpp @@ -0,0 +1,33 @@ +// Test is line- and column-sensitive; see below. + +typedef int Integer; +struct X { + void f() { + int localA, localB; + auto lambda = [&localA, localB] (Integer x) -> Integer { + return localA + localB + x; + }; + } +}; + +// RUN: c-index-test -test-load-source all -std=c++11 %s | FileCheck -check-prefix=CHECK-LOAD %s +// CHECK-LOAD: cxx11-lambdas.cpp:7:19: LambdaExpr= Extent=[7:19 - 9:6] +// CHECK-LOAD: cxx11-lambdas.cpp:7:21: VariableRef=localA:6:9 Extent=[7:21 - 7:27] +// CHECK-LOAD: cxx11-lambdas.cpp:7:29: VariableRef=localB:6:17 Extent=[7:29 - 7:35] +// CHECK-LOAD: cxx11-lambdas.cpp:7:52: TypeRef=Integer:3:13 Extent=[7:52 - 7:59] +// CHECK-LOAD: cxx11-lambdas.cpp:7:46: ParmDecl=x:7:46 (Definition) Extent=[7:38 - 7:47] +// CHECK-LOAD: cxx11-lambdas.cpp:7:38: TypeRef=Integer:3:13 Extent=[7:38 - 7:45] +// CHECK-LOAD: cxx11-lambdas.cpp:7:60: CompoundStmt= Extent=[7:60 - 9:6] +// CHECK-LOAD: cxx11-lambdas.cpp:8:7: ReturnStmt= Extent=[8:7 - 8:33] +// CHECK-LOAD: cxx11-lambdas.cpp:8:14: DeclRefExpr=localA:6:9 Extent=[8:14 - 8:20] +// CHECK-LOAD: cxx11-lambdas.cpp:8:23: DeclRefExpr=localB:6:17 Extent=[8:23 - 8:29] +// CHECK-LOAD: cxx11-lambdas.cpp:8:32: DeclRefExpr=x:7:46 Extent=[8:32 - 8:33] + +// RUN: env CINDEXTEST_INDEXLOCALSYMBOLS=1 c-index-test -index-file -std=c++11 %s | FileCheck -check-prefix=CHECK-INDEX %s +// CHECK-INDEX: [indexEntityReference]: kind: variable | name: localA | USR: c:cxx11-lambdas.cpp@100@S@X@F@f#@localA | lang: C | cursor: VariableRef=localA:6:9 | loc: 7:21 +// CHECK-INDEX: [indexEntityReference]: kind: variable | name: localB | USR: c:cxx11-lambdas.cpp@100@S@X@F@f#@localB | lang: C | cursor: VariableRef=localB:6:17 | loc: 7:29 +// CHECK-INDEX: [indexEntityReference]: kind: typedef | name: Integer | USR: c:cxx11-lambdas.cpp@51@T@Integer | lang: C | cursor: TypeRef=Integer:3:13 | loc: 7:52 +// CHECK-INDEX: [indexEntityReference]: kind: typedef | name: Integer | USR: c:cxx11-lambdas.cpp@51@T@Integer | lang: C | cursor: TypeRef=Integer:3:13 | loc: 7:38 +// CHECK-INDEX: [indexEntityReference]: kind: variable | name: localA | USR: c:cxx11-lambdas.cpp@100@S@X@F@f#@localA | lang: C | cursor: DeclRefExpr=localA:6:9 | loc: 8:14 +// CHECK-INDEX: [indexEntityReference]: kind: variable | name: localB | USR: c:cxx11-lambdas.cpp@100@S@X@F@f#@localB | lang: C | cursor: DeclRefExpr=localB:6:17 | loc: 8:23 +// CHECK-INDEX: [indexEntityReference]: kind: variable | name: x | USR: c:cxx11-lambdas.cpp@157@S@X@F@f#@Ca@F@operator()#I#1@x | lang: C | cursor: DeclRefExpr=x:7:46 | loc: 8:32 diff --git a/test/Index/error-on-deserialized.c b/test/Index/error-on-deserialized.c new file mode 100644 index 000000000000..8ba828328e7a --- /dev/null +++ b/test/Index/error-on-deserialized.c @@ -0,0 +1,13 @@ + +#include "targeted-top.h" + +// This tests that we will correctly error out on the deserialized decl. + +// RUN: c-index-test -write-pch %t.h.pch %S/targeted-top.h +// RUN: env CINDEXTEST_FAILONERROR=1 not c-index-test -cursor-at=%S/targeted-nested1.h:2:16 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-nested1.h:2:16 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 2>&1 \ +// RUN: | FileCheck %s + +// CHECK: error: NestedVar1 was deserialized diff --git a/test/Index/file-macro-refs.c b/test/Index/file-macro-refs.c new file mode 100644 index 000000000000..ed01cf5223f0 --- /dev/null +++ b/test/Index/file-macro-refs.c @@ -0,0 +1,12 @@ +#define FOO + +FOO +FOO + +// RUN: c-index-test -file-refs-at=%s:3:2 %s | FileCheck %s +// RUN: env CINDEXTEST_EDITING=1 c-index-test -file-refs-at=%s:3:2 %s | FileCheck %s + +// CHECK: macro expansion=FOO:1:9 +// CHECK-NEXT: macro definition=FOO =[1:9 - 1:12] +// CHECK-NEXT: macro expansion=FOO:1:9 =[3:1 - 3:4] +// CHECK-NEXT: macro expansion=FOO:1:9 =[4:1 - 4:4] diff --git a/test/Index/file-refs-subscripting.m b/test/Index/file-refs-subscripting.m new file mode 100644 index 000000000000..493d93d12e4d --- /dev/null +++ b/test/Index/file-refs-subscripting.m @@ -0,0 +1,65 @@ +@interface NSArray +- (id)objectAtIndexedSubscript:(int)index; ++ (id)arrayWithObjects:(id *)objects count:(unsigned)count; +@end + +@interface NSMutableArray : NSArray +- (id)objectAtIndexedSubscript:(int)index; +- (void)setObject:(id)object atIndexedSubscript:(int)index; +@end + +@interface NSDictionary +- (id)objectForKeyedSubscript:(id)key; ++ (id)dictionaryWithObjects:(id *)objects forKeys:(id *)keys count:(unsigned)count; +@end + +@interface NSMutableDictionary : NSDictionary +- (void)setObject:(id)object forKeyedSubscript:(id)key; +@end + +@class NSString; + +id testArray(int index, id p) { + NSMutableArray *array; + array[3] = 0; + NSArray *arr = @[ p, p ]; + return array[index]; +} + +void testDict() { + NSMutableDictionary *dictionary; + NSString *key; + id newObject, oldObject; + oldObject = dictionary[key]; + dictionary[key] = newObject; + NSDictionary *dict = @{ key: newObject, key: oldObject }; +} + +// RUN: c-index-test \ + +// RUN: -file-refs-at=%s:22:21 \ +// CHECK: ParmDecl=index:22:18 +// CHECK-NEXT: ParmDecl=index:22:18 (Definition) =[22:18 - 22:23] +// CHECK-NEXT: DeclRefExpr=index:22:18 =[26:16 - 26:21] + +// RUN: -file-refs-at=%s:22:28 \ +// CHECK-NEXT: ParmDecl=p:22:28 +// CHECK-NEXT: ParmDecl=p:22:28 (Definition) =[22:28 - 22:29] +// CHECK-NEXT: DeclRefExpr=p:22:28 =[25:21 - 25:22] +// CHECK-NEXT: DeclRefExpr=p:22:28 =[25:24 - 25:25] + +// RUN: -file-refs-at=%s:34:16 \ +// CHECK-NEXT: DeclRefExpr=key:31:13 +// CHECK-NEXT: VarDecl=key:31:13 (Definition) =[31:13 - 31:16] +// CHECK-NEXT: DeclRefExpr=key:31:13 =[33:26 - 33:29] +// CHECK-NEXT: DeclRefExpr=key:31:13 =[34:14 - 34:17] +// CHECK-NEXT: DeclRefExpr=key:31:13 =[35:27 - 35:30] +// CHECK-NEXT: DeclRefExpr=key:31:13 =[35:43 - 35:46] + +// RUN: -file-refs-at=%s:35:35 \ +// CHECK-NEXT: DeclRefExpr=newObject:32:6 +// CHECK-NEXT: VarDecl=newObject:32:6 (Definition) =[32:6 - 32:15] +// CHECK-NEXT: DeclRefExpr=newObject:32:6 =[34:21 - 34:30] +// CHECK-NEXT: DeclRefExpr=newObject:32:6 =[35:32 - 35:41] + +// RUN: -target x86_64-apple-macosx10.7 %s | FileCheck %s diff --git a/test/Index/file-refs.m b/test/Index/file-refs.m index 2267259d58a2..3f21c9eb9319 100644 --- a/test/Index/file-refs.m +++ b/test/Index/file-refs.m @@ -43,24 +43,28 @@ void test2(Sub *s, id<Prot1> p) { // RUN: -file-refs-at=%s:7:18 \ // CHECK: ObjCImplementationDecl=Foo:7:17 (Definition) + +// FIXME: There should not be 2 for the same range. +// CHECK-NEXT: ObjCInterfaceDecl=Foo:1:8 =[1:8 - 1:11] // CHECK-NEXT: ObjCClassRef=Foo:3:12 =[1:8 - 1:11] + // CHECK-NEXT: ObjCInterfaceDecl=Foo:3:12 =[3:12 - 3:15] // CHECK-NEXT: ObjCImplementationDecl=Foo:7:17 (Definition) =[7:17 - 7:20] // CHECK-NEXT: ObjCClassRef=Foo:3:12 =[13:11 - 13:14] // RUN: -file-refs-at=%s:4:10 \ -// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:1 -// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:1 =[4:6 - 4:16] -// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::8:1 (Definition) [Overrides @4:1] =[8:6 - 8:16] -// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1 =[14:8 - 14:18] -// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1 =[15:8 - 15:18] +// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:6 +// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:6 =[4:6 - 4:16] +// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::8:6 (Definition) =[8:6 - 8:16] +// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:6 =[14:8 - 14:18] +// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:6 =[15:8 - 15:18] // RUN: -file-refs-at=%s:15:27 \ -// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1 -// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:1 =[4:24 - 4:32] -// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::8:1 (Definition) [Overrides @4:1] =[8:24 - 8:32] -// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1 =[14:21 - 14:29] -// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:1 =[15:22 - 15:30] +// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:6 +// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::4:6 =[4:24 - 4:32] +// CHECK-NEXT: ObjCInstanceMethodDecl=setWithInt:andFloat::8:6 (Definition) =[8:24 - 8:32] +// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:6 =[14:21 - 14:29] +// CHECK-NEXT: ObjCMessageExpr=setWithInt:andFloat::4:6 =[15:22 - 15:30] // RUN: -file-refs-at=%s:18:13 \ // CHECK-NEXT: ObjCProtocolDecl=Prot1:18:11 (Definition) @@ -69,19 +73,19 @@ void test2(Sub *s, id<Prot1> p) { // CHECK-NEXT: ObjCProtocolRef=Prot1:18:11 =[36:23 - 36:28] // RUN: -file-refs-at=%s:38:10 \ -// CHECK-NEXT: ObjCMessageExpr=protMeth:19:1 -// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:19:1 =[19:8 - 19:16] -// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:29:1 [Overrides @19:1] =[29:8 - 29:16] -// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:1 (Definition) [Overrides @29:1] =[33:8 - 33:16] -// CHECK-NEXT: ObjCMessageExpr=protMeth:29:1 =[37:6 - 37:14] -// CHECK-NEXT: ObjCMessageExpr=protMeth:19:1 =[38:6 - 38:14] +// CHECK-NEXT: ObjCMessageExpr=protMeth:19:8 +// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:19:8 =[19:8 - 19:16] +// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:29:8 [Overrides @19:8] =[29:8 - 29:16] +// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:8 (Definition) [Overrides @19:8] =[33:8 - 33:16] +// CHECK-NEXT: ObjCMessageExpr=protMeth:29:8 =[37:6 - 37:14] +// CHECK-NEXT: ObjCMessageExpr=protMeth:19:8 =[38:6 - 38:14] // RUN: -file-refs-at=%s:33:12 \ -// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:1 (Definition) [Overrides @29:1] -// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:19:1 =[19:8 - 19:16] -// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:29:1 [Overrides @19:1] =[29:8 - 29:16] -// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:1 (Definition) [Overrides @29:1] =[33:8 - 33:16] -// CHECK-NEXT: ObjCMessageExpr=protMeth:29:1 =[37:6 - 37:14] -// CHECK-NEXT: ObjCMessageExpr=protMeth:19:1 =[38:6 - 38:14] +// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:8 (Definition) [Overrides @19:8] +// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:19:8 =[19:8 - 19:16] +// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:29:8 [Overrides @19:8] =[29:8 - 29:16] +// CHECK-NEXT: ObjCInstanceMethodDecl=protMeth:33:8 (Definition) [Overrides @19:8] =[33:8 - 33:16] +// CHECK-NEXT: ObjCMessageExpr=protMeth:29:8 =[37:6 - 37:14] +// CHECK-NEXT: ObjCMessageExpr=protMeth:19:8 =[38:6 - 38:14] // RUN: %s | FileCheck %s diff --git a/test/Index/fix-its.c b/test/Index/fix-its.c index d82f2998e6fd..d5cb1af854cf 100644 --- a/test/Index/fix-its.c +++ b/test/Index/fix-its.c @@ -8,7 +8,7 @@ struct X { void f(struct X *x) { // CHECK: error: no member named 'wobble' in 'struct X'; did you mean 'wibble'? - // CHECK-NOT: FIX-IT + // CHECK: FIX-IT: Replace [13:12 - 13:18] with "wibble" // CHECK: note: 'wibble' declared here MACRO(x->wobble = 17); // CHECK: error: no member named 'wabble' in 'struct X'; did you mean 'wibble'? @@ -16,3 +16,12 @@ void f(struct X *x) { // CHECK: note: 'wibble' declared here x->wabble = 17; } + +int printf(const char *restrict, ...); + +void f2() { + unsigned long index; + // CHECK: warning: format specifies type 'int' but the argument has type 'unsigned long' + // CHECK: FIX-IT: Replace [26:17 - 26:19] with "%ld" + MACRO(printf("%d", index)); +} diff --git a/test/Index/get-cursor-macro-args.m b/test/Index/get-cursor-macro-args.m index 4e0ac78fe059..4945fd389ad3 100644 --- a/test/Index/get-cursor-macro-args.m +++ b/test/Index/get-cursor-macro-args.m @@ -14,6 +14,6 @@ // RUN: %s -include-pch %t.pch | FileCheck %s // CHECK: ObjCClassRef=MyClass:1:12 -// CHECK-NEXT: ObjCMessageExpr=meth:2:1 -// CHECK-NEXT: ObjCMessageExpr=meth:2:1 +// CHECK-NEXT: ObjCMessageExpr=meth:2:8 +// CHECK-NEXT: ObjCMessageExpr=meth:2:8 // CHECK-NEXT: ObjCClassRef=MyClass:1:12 diff --git a/test/Index/get-cursor.cpp b/test/Index/get-cursor.cpp index 441ed1cdabe6..e1e6835becad 100644 --- a/test/Index/get-cursor.cpp +++ b/test/Index/get-cursor.cpp @@ -33,6 +33,11 @@ struct YDerived : Y { void test() { X foo; + + try { + } catch (X e) { + X x; + } } // RUN: c-index-test -cursor-at=%s:6:4 %s | FileCheck -check-prefix=CHECK-COMPLETION-1 %s @@ -80,3 +85,11 @@ void test() { // RUN: c-index-test -cursor-at=%s:21:3 %s | FileCheck -check-prefix=CHECK-MEMBER %s // CHECK-MEMBER: FieldDecl=member:21:7 (Definition) // CHECK-MEMBER-NEXT: Completion string: {ResultType int}{TypedText member} + +// RUN: c-index-test -cursor-at=%s:38:12 -cursor-at=%s:39:5 %s | FileCheck -check-prefix=CHECK-CXXCATCH %s +// CHECK-CXXCATCH: TypeRef=struct X:3:8 +// CHECK-CXXCATCH-NEXT: TypeRef=struct X:3:8 + +// RUN: c-index-test -test-load-source-usrs local %s | FileCheck -check-prefix=CHECK-USR %s +// CHECK-USR: get-cursor.cpp c:get-cursor.cpp@472@F@test#@e Extent=[38:12 - 38:15] +// CHECK-USR: get-cursor.cpp c:get-cursor.cpp@483@F@test#@x Extent=[39:5 - 39:8] diff --git a/test/Index/get-cursor.m b/test/Index/get-cursor.m index 69e4f251e821..60e35eedd427 100644 --- a/test/Index/get-cursor.m +++ b/test/Index/get-cursor.m @@ -26,12 +26,62 @@ @synthesize name = _name; @end +@interface rdar10902015 +@end + +@implementation rdar10902015 + +struct S { int x; }; + +-(void)mm:(struct S*)s { + rdar10902015 *i = 0; + s->x = 0; + Test1 *test1; + test1.name = 0; +} +@end + +@interface Test2 +-(int)implicitProp; +-(void)setImplicitProp:(int)x; +@end + +void foo1(Test2 *test2) { + int x = test2.implicitProp; + test2.implicitProp = x; + ++test2.implicitProp; +} + +@interface Test3 +-(void)setFoo:(int)x withBar:(int)y; +@end + +void foo3(Test3 *test3) { + [test3 setFoo:2 withBar:4]; +} + // RUN: c-index-test -cursor-at=%s:4:28 -cursor-at=%s:5:28 %s | FileCheck -check-prefix=CHECK-PROP %s // CHECK-PROP: ObjCPropertyDecl=foo1:4:26 // CHECK-PROP: ObjCPropertyDecl=foo2:5:27 -// RUN: c-index-test -cursor-at=%s:11:11 %s -ccc-host-triple x86_64-apple-macosx10.7.0 | FileCheck -check-prefix=CHECK-WITH-WEAK %s +// RUN: c-index-test -cursor-at=%s:11:11 %s -target x86_64-apple-macosx10.7.0 | FileCheck -check-prefix=CHECK-WITH-WEAK %s // CHECK-WITH-WEAK: ObjCClassRef=Foo:8:8 // RUN: c-index-test -cursor-at=%s:20:10 %s | FileCheck -check-prefix=CHECK-METHOD %s -// CHECK-METHOD: ObjCInstanceMethodDecl=name:20:1 +// CHECK-METHOD: 20:7 ObjCInstanceMethodDecl=name:20:7 Extent=[20:1 - 20:12] + +// RUN: c-index-test -cursor-at=%s:37:17 %s | FileCheck -check-prefix=CHECK-IN-IMPL %s +// CHECK-IN-IMPL: VarDecl=i:37:17 + +// RUN: c-index-test -cursor-at=%s:38:6 -cursor-at=%s:40:11 \ +// RUN: -cursor-at=%s:50:20 -cursor-at=%s:51:15 -cursor-at=%s:52:20 %s | FileCheck -check-prefix=CHECK-MEMBERREF %s +// CHECK-MEMBERREF: 38:6 MemberRefExpr=x:34:16 SingleRefName=[38:6 - 38:7] RefName=[38:6 - 38:7] Extent=[38:3 - 38:7] +// CHECK-MEMBERREF: 40:9 MemberRefExpr=name:23:21 Extent=[40:3 - 40:13] Spelling=name ([40:9 - 40:13]) +// CHECK-MEMBERREF: 50:17 MemberRefExpr=implicitProp:45:7 Extent=[50:11 - 50:29] Spelling=implicitProp ([50:17 - 50:29]) +// CHECK-MEMBERREF: 51:9 MemberRefExpr=setImplicitProp::46:8 Extent=[51:3 - 51:21] Spelling=setImplicitProp: ([51:9 - 51:21]) +// CHECK-MEMBERREF: 52:11 MemberRefExpr=setImplicitProp::46:8 Extent=[52:5 - 52:23] Spelling=setImplicitProp: ([52:11 - 52:23]) + +// RUN: c-index-test -cursor-at=%s:56:24 -cursor-at=%s:60:14 \ +// RUN: %s | FileCheck -check-prefix=CHECK-SPELLRANGE %s +// CHECK-SPELLRANGE: 56:8 ObjCInstanceMethodDecl=setFoo:withBar::56:8 Extent=[56:1 - 56:37] Spelling=setFoo:withBar: ([56:8 - 56:14][56:22 - 56:29]) Selector index=1 +// CHECK-SPELLRANGE: 60:3 ObjCMessageExpr=setFoo:withBar::56:8 Extent=[60:3 - 60:29] Spelling=setFoo:withBar: ([60:10 - 60:16][60:19 - 60:26]) Selector index=0 diff --git a/test/Index/index-attrs.m b/test/Index/index-attrs.m new file mode 100644 index 000000000000..09c52ba3dcfe --- /dev/null +++ b/test/Index/index-attrs.m @@ -0,0 +1,17 @@ +@class Foo; +@interface Bar +@property (retain) __attribute__((iboutletcollection(Foo))) Foo *prop; +@end + +@interface I +-(id)prop __attribute__((annotate("anno"))); +-(void)setProp:(id)p __attribute__((annotate("anno"))); +@property (assign) id prop __attribute__((annotate("anno"))); +@end + +// RUN: c-index-test -index-file %s | FileCheck %s +// CHECK: <attribute>: attribute(iboutletcollection)= [IBOutletCollection=ObjCInterface] + +// CHECK: <attribute>: attribute(annotate)=anno +// CHECK: <getter>: kind: objc-instance-method | name: prop | {{.*}} <attribute>: attribute(annotate)=anno +// CHECK: <setter>: kind: objc-instance-method | name: setProp: | {{.*}} <attribute>: attribute(annotate)=anno diff --git a/test/Index/index-decls.m b/test/Index/index-decls.m new file mode 100644 index 000000000000..9e4e620497fe --- /dev/null +++ b/test/Index/index-decls.m @@ -0,0 +1,30 @@ +@interface I +@property (readonly) id prop; + -(id)prop; +@end + +@interface I() +@property (assign,readwrite) id prop; +@end + +@implementation I +@synthesize prop = _prop; +@end + +rdar://11015325 +@interface I1 +__attribute__((something)) @interface I2 @end +@end + +// RUN: c-index-test -index-file %s > %t +// RUN: FileCheck %s -input-file=%t +// CHECK: [indexDeclaration]: kind: objc-class | name: I | {{.*}} | loc: 1:12 +// CHECK: [indexDeclaration]: kind: objc-instance-method | name: prop | {{.*}} | loc: 3:2 +// CHECK: [indexDeclaration]: kind: objc-property | name: prop | {{.*}} | loc: 2:25 +// CHECK: [indexDeclaration]: kind: objc-category | name: | {{.*}} | loc: 6:12 +// CHECK: [indexDeclaration]: kind: objc-instance-method | name: setProp: | {{.*}} | loc: 7:33 +// CHECK: [indexDeclaration]: kind: objc-property | name: prop | {{.*}} | loc: 7:33 + +// CHECK: [indexDeclaration]: kind: objc-ivar | name: _prop | {{.*}} | loc: 11:20 +// CHECK: [indexDeclaration]: kind: objc-instance-method | name: prop | {{.*}} | loc: 11:13 | {{.*}} | lexical-container: [I:10:17] +// CHECK: [indexDeclaration]: kind: objc-instance-method | name: setProp: | {{.*}} | loc: 11:13 | {{.*}} | lexical-container: [I:10:17] diff --git a/test/Index/index-invalid-code.m b/test/Index/index-invalid-code.m new file mode 100644 index 000000000000..90845330b196 --- /dev/null +++ b/test/Index/index-invalid-code.m @@ -0,0 +1,8 @@ +struct S { + int { +}; +typedef struct S S; + +// RUN: c-index-test -index-file %s | FileCheck %s +// CHECK: [indexDeclaration]: kind: struct | name: S | +// CHECK-NOT: [indexDeclaration]: kind: struct | name: S | diff --git a/test/Index/index-many-logical-ops.c b/test/Index/index-many-logical-ops.c new file mode 100644 index 000000000000..67017decb777 --- /dev/null +++ b/test/Index/index-many-logical-ops.c @@ -0,0 +1,2011 @@ +// RUN: c-index-test -index-file %s | FileCheck %s + +// rdar://10941790 +// Check that we don't get stack overflow trying to index a huge number of +// logical operators. + +// CHECK: [indexDeclaration]: kind: function | name: foo +int foo(int x) { + return + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x && + x; +} diff --git a/test/Index/index-refs.cpp b/test/Index/index-refs.cpp new file mode 100644 index 000000000000..77e2af71f885 --- /dev/null +++ b/test/Index/index-refs.cpp @@ -0,0 +1,121 @@ + +namespace NS { + extern int gx; + typedef int MyInt; +} + +enum { + EnumVal = 1 +}; + +NS::MyInt NS::gx = EnumVal; + +void foo() { + NS::MyInt x; +} + +enum { + SecondVal = EnumVal +}; + +struct S { + S& operator++(); + int operator*(); + S& operator=(int x); + S& operator!=(int x); + S& operator()(int x); +}; + +void foo2(S &s) { + (void)++s; + (void)*s; + s = 3; + (void)(s != 3); + s(3); +} + +namespace NS { + namespace Inn {} + typedef int Foo; +} + +using namespace NS; +using namespace NS::Inn; +using NS::Foo; + +template <typename T1, typename T2> +struct TS { }; + +template <typename T> +struct TS<T, int> { + typedef int MyInt; +}; + +void foo3() { + TS<int, int> s; +} + +const int array_size = 3; +typedef int some_arr[array_size]; + +const int default_param = 3; +void foo4(int p = default_param); + +struct S2 { + int x,y; +}; + +void foo5() { + struct S2 s = { .y = 1, .x = 4}; +} + +// RUN: c-index-test -index-file %s | FileCheck %s +// CHECK: [indexDeclaration]: kind: namespace | name: NS +// CHECK-NEXT: [indexDeclaration]: kind: variable | name: gx +// CHECK-NEXT: [indexDeclaration]: kind: typedef | name: MyInt +// CHECK-NEXT: [indexDeclaration]: kind: enum +// CHECK-NEXT: [indexDeclaration]: kind: enumerator | name: EnumVal +// CHECK-NEXT: [indexDeclaration]: kind: variable | name: gx +// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS +// CHECK-NEXT: [indexEntityReference]: kind: typedef | name: MyInt +// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS +// CHECK-NEXT: [indexEntityReference]: kind: enumerator | name: EnumVal +// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo +// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS +// CHECK-NEXT: [indexEntityReference]: kind: typedef | name: MyInt +// CHECK-NEXT: [indexDeclaration]: kind: enum +// CHECK-NEXT: [indexDeclaration]: kind: enumerator | name: SecondVal +// CHECK-NEXT: [indexEntityReference]: kind: enumerator | name: EnumVal + +// CHECK: [indexDeclaration]: kind: function | name: foo2 +// CHECK: [indexEntityReference]: kind: c++-instance-method | name: operator++ +// CHECK-NEXT: [indexEntityReference]: kind: c++-instance-method | name: operator* +// CHECK-NEXT: [indexEntityReference]: kind: c++-instance-method | name: operator= +// CHECK-NEXT: [indexEntityReference]: kind: c++-instance-method | name: operator!= +// CHECK-NEXT: [indexEntityReference]: kind: c++-instance-method | name: operator() + +// CHECK: [indexEntityReference]: kind: namespace | name: NS | {{.*}} | loc: 42:17 +// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS | {{.*}} | loc: 43:17 +// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: Inn | {{.*}} | loc: 43:21 +// CHECK-NEXT: [indexEntityReference]: kind: namespace | name: NS | {{.*}} | loc: 44:7 +// CHECK-NEXT: [indexEntityReference]: kind: typedef | name: Foo | {{.*}} | loc: 44:11 + +// CHECK: [indexDeclaration]: kind: c++-class-template | name: TS | {{.*}} | loc: 47:8 +// CHECK-NEXT: [indexDeclaration]: kind: struct-template-partial-spec | name: TS | USR: c:@SP>1#T@TS>#t0.0#I | {{.*}} | loc: 50:8 +// CHECK-NEXT: [indexDeclaration]: kind: typedef | name: MyInt | USR: c:index-refs.cpp@593@SP>1#T@TS>#t0.0#I@T@MyInt | {{.*}} | loc: 51:15 | semantic-container: [TS:50:8] | lexical-container: [TS:50:8] +/* when indexing implicit instantiations + [indexDeclaration]: kind: struct-template-spec | name: TS | USR: c:@S@TS>#I | {{.*}} | loc: 50:8 + [indexDeclaration]: kind: typedef | name: MyInt | USR: c:index-refs.cpp@593@S@TS>#I@T@MyInt | {{.*}} | loc: 51:15 | semantic-container: [TS:50:8] | lexical-container: [TS:50:8] + */ +// CHECK-NEXT: [indexDeclaration]: kind: function | name: foo3 +/* when indexing implicit instantiations + [indexEntityReference]: kind: struct-template-spec | name: TS | USR: c:@S@TS>#I | {{.*}} | loc: 55:3 +*/ +// CHECK-NEXT: [indexEntityReference]: kind: c++-class-template | name: TS | USR: c:@ST>2#T#T@TS | {{.*}} | loc: 55:3 + +// CHECK: [indexEntityReference]: kind: variable | name: array_size | {{.*}} | loc: 59:22 +// CHECK: [indexEntityReference]: kind: variable | name: default_param | {{.*}} | loc: 62:19 +// CHECK-NOT: [indexEntityReference]: kind: variable | name: default_param | {{.*}} | loc: 62:19 + +// CHECK: [indexEntityReference]: kind: field | name: y | {{.*}} | loc: 69:20 +// CHECK-NEXT: [indexEntityReference]: kind: field | name: x | {{.*}} | loc: 69:28 diff --git a/test/Index/index-subscripting-literals.m b/test/Index/index-subscripting-literals.m new file mode 100644 index 000000000000..4ecad0b9252c --- /dev/null +++ b/test/Index/index-subscripting-literals.m @@ -0,0 +1,66 @@ +@interface NSArray +- (id)objectAtIndexedSubscript:(int)index; ++ (id)arrayWithObjects:(id *)objects count:(unsigned)count; +@end + +@interface NSMutableArray : NSArray +- (id)objectAtIndexedSubscript:(int)index; +- (void)setObject:(id)object atIndexedSubscript:(int)index; +@end + +@interface NSDictionary +- (id)objectForKeyedSubscript:(id)key; ++ (id)dictionaryWithObjects:(id *)objects forKeys:(id *)keys count:(unsigned)count; +@end + +@interface NSMutableDictionary : NSDictionary +- (void)setObject:(id)object forKeyedSubscript:(id)key; +@end + +@class NSString; + +int idx; +id p; + +id testArray() { + NSMutableArray *array; + array[idx] = p; + NSArray *arr = @[ p, p ]; + return array[idx]; +} + +NSString *key; +id newObject, oldObject; + +void testDict() { + NSMutableDictionary *dictionary; + oldObject = dictionary[key]; + dictionary[key] = newObject; + NSDictionary *dict = @{ key: newObject, key: oldObject }; +} + +// RUN: c-index-test -index-file -target x86_64-apple-macosx10.7 %s | FileCheck %s + +// CHECK: [indexEntityReference]: kind: variable | name: idx | USR: c:@idx | lang: C | cursor: DeclRefExpr=idx:22:5 | loc: 27:9 +// CHECK-NEXT: [indexEntityReference]: kind: variable | name: p | USR: c:@p | lang: C | cursor: DeclRefExpr=p:23:4 | loc: 27:16 | <parent>:: kind: function | name: testArray | USR: c:@F@testArray | lang: C | container: [testArray:25:4] | refkind: direct +// CHECK-NEXT: [indexEntityReference]: kind: objc-instance-method | name: setObject:atIndexedSubscript: +// CHECK-NEXT: [indexEntityReference]: kind: objc-class | name: NSArray +// CHECK-NEXT: [indexEntityReference]: kind: objc-class-method | name: arrayWithObjects:count: +// CHECK-NEXT: [indexEntityReference]: kind: variable | name: p | USR: c:@p | lang: C | cursor: DeclRefExpr=p:23:4 | loc: 28:21 +// CHECK-NEXT: [indexEntityReference]: kind: variable | name: p | USR: c:@p | lang: C | cursor: DeclRefExpr=p:23:4 | loc: 28:24 +// CHECK-NEXT: [indexEntityReference]: kind: variable | name: idx | USR: c:@idx | lang: C | cursor: DeclRefExpr=idx:22:5 | loc: 29:16 +// CHECK-NEXT: [indexEntityReference]: kind: objc-instance-method | name: objectAtIndexedSubscript: +// CHECK-NEXT: [indexDeclaration]: kind: variable | name: key + +// CHECK: [indexEntityReference]: kind: variable | name: oldObject +// CHECK-NEXT: [indexEntityReference]: kind: variable | name: key | USR: c:@key | lang: C | cursor: DeclRefExpr=key:32:11 | loc: 37:26 +// CHECK-NEXT: [indexEntityReference]: kind: objc-instance-method | name: objectForKeyedSubscript: +// CHECK-NEXT: [indexEntityReference]: kind: variable | name: key | USR: c:@key | lang: C | cursor: DeclRefExpr=key:32:11 | loc: 38:14 +// CHECK-NEXT: [indexEntityReference]: kind: variable | name: newObject | USR: c:@newObject | lang: C | cursor: DeclRefExpr=newObject:33:4 | loc: 38:21 +// CHECK-NEXT: [indexEntityReference]: kind: objc-instance-method | name: setObject:forKeyedSubscript: +// CHECK-NEXT: [indexEntityReference]: kind: objc-class | name: NSDictionary +// CHECK-NEXT: [indexEntityReference]: kind: objc-class-method | name: dictionaryWithObjects:forKeys:count: +// CHECK-NEXT: [indexEntityReference]: kind: variable | name: key | USR: c:@key | lang: C | cursor: DeclRefExpr=key:32:11 | loc: 39:27 +// CHECK-NEXT: [indexEntityReference]: kind: variable | name: newObject | USR: c:@newObject | lang: C | cursor: DeclRefExpr=newObject:33:4 | loc: 39:32 +// CHECK-NEXT: [indexEntityReference]: kind: variable | name: key | USR: c:@key | lang: C | cursor: DeclRefExpr=key:32:11 | loc: 39:43 +// CHECK-NEXT: [indexEntityReference]: kind: variable | name: oldObject | USR: c:@oldObject | lang: C | cursor: DeclRefExpr=oldObject:33:15 | loc: 39:48 diff --git a/test/Index/index-suppress-refs.cpp b/test/Index/index-suppress-refs.cpp new file mode 100644 index 000000000000..113dd4076c30 --- /dev/null +++ b/test/Index/index-suppress-refs.cpp @@ -0,0 +1,12 @@ + +#include "index-suppress-refs.hpp" + +class Sub : B1, B2 { + typedef B1 Base1; + typedef B2 Base2; +}; + +// RUN: env CINDEXTEST_SUPPRESSREFS=1 c-index-test -index-file %s | FileCheck %s +// CHECK: [indexDeclaration]: kind: c++-class | name: Sub +// CHECK-NOT: [indexEntityReference]: kind: c++-class | name: B1 +// CHECK-NOT: [indexEntityReference]: kind: c++-class | name: B2 diff --git a/test/Index/index-suppress-refs.h b/test/Index/index-suppress-refs.h new file mode 100644 index 000000000000..03c56243ba6f --- /dev/null +++ b/test/Index/index-suppress-refs.h @@ -0,0 +1,9 @@ + +@interface I +@end + +@interface B +@end + +@protocol P +@end diff --git a/test/Index/index-suppress-refs.hpp b/test/Index/index-suppress-refs.hpp new file mode 100644 index 000000000000..4aab08bf1cc4 --- /dev/null +++ b/test/Index/index-suppress-refs.hpp @@ -0,0 +1,3 @@ + +class B1 {}; +class B2 {}; diff --git a/test/Index/index-suppress-refs.m b/test/Index/index-suppress-refs.m new file mode 100644 index 000000000000..46420ee0c7d3 --- /dev/null +++ b/test/Index/index-suppress-refs.m @@ -0,0 +1,44 @@ + +#include "index-suppress-refs.h" + +#define TYPEDEF(x) typedef int x +TYPEDEF(MyInt); + +MyInt gx; + +@class I; + +@interface I(cat) +-(I*)meth; +@end + +@class I; + +@interface S : B<P> +-(void)meth:(B*)b :(id<P>)p; +@end + +// RUN: env CINDEXTEST_SUPPRESSREFS=1 c-index-test -index-file %s | FileCheck %s +// CHECK: [indexDeclaration]: kind: objc-class | name: I +// CHECK-NEXT: <ObjCContainerInfo>: kind: interface +// CHECK-NEXT: [indexDeclaration]: kind: objc-class | name: B +// CHECK-NEXT: <ObjCContainerInfo>: kind: interface +// CHECK-NEXT: [indexDeclaration]: kind: objc-protocol | name: P +// CHECK-NEXT: <ObjCContainerInfo>: kind: interface +// CHECK-NEXT: [indexDeclaration]: kind: typedef | name: MyInt +// CHECK-NEXT: [indexDeclaration]: kind: variable | name: gx +// CHECK-NEXT: [indexDeclaration]: kind: objc-class | name: I +// CHECK-NEXT: <ObjCContainerInfo>: kind: forward-ref +// CHECK-NEXT: [indexDeclaration]: kind: objc-category | name: cat +// CHECK-NEXT: <ObjCContainerInfo>: kind: interface +// CHECK-NEXT: <ObjCCategoryInfo>: class: kind: objc-class | name: I +// CHECK-NEXT: [indexDeclaration]: kind: objc-instance-method | name: meth +// CHECK-NOT: [indexEntityReference]: kind: objc-class | name: I +// CHECK-NOT: [indexDeclaration]: kind: objc-class | name: I +// CHECK-NEXT: [indexDeclaration]: kind: objc-class | name: S +// CHECK-NEXT: <ObjCContainerInfo>: kind: interface +// CHECK-NEXT: <base>: kind: objc-class | name: B +// CHECK-NEXT: <protocol>: kind: objc-protocol | name: P +// CHECK-NEXT: [indexDeclaration]: kind: objc-instance-method | name: meth:: +// CHECK-NOT: [indexEntityReference]: kind: objc-class | name: B +// CHECK-NOT: [indexEntityReference]: kind: objc-protocol | name: P
\ No newline at end of file diff --git a/test/Index/invalid-code-rdar10451854.m b/test/Index/invalid-code-rdar10451854.m new file mode 100644 index 000000000000..156267199b40 --- /dev/null +++ b/test/Index/invalid-code-rdar10451854.m @@ -0,0 +1,15 @@ +struct { + +@implementation Foo + +- (void)finalize { + NSLog(@"bar"); +} + +- (NSArray *)graphics { +} + +@end + +// Test that we don't crash +// RUN: c-index-test -test-load-source-reparse 3 local %s diff --git a/test/Index/invalid-rdar-8236270.cpp b/test/Index/invalid-rdar-8236270.cpp index 4593b512ee24..85a0eaadbb6f 100644 --- a/test/Index/invalid-rdar-8236270.cpp +++ b/test/Index/invalid-rdar-8236270.cpp @@ -1,4 +1,4 @@ -// RUN: c-index-test -test-load-source all %s 2>&1 | FileCheck %s +// RUN: c-index-test -test-load-source all %s | FileCheck %s // This test case previously just crashed the frontend. diff --git a/test/Index/linkage.c b/test/Index/linkage.c index d1f1c5bca541..41a1fbdd71c9 100644 --- a/test/Index/linkage.c +++ b/test/Index/linkage.c @@ -11,6 +11,8 @@ void bar(int y) { extern int n; static int wibble(int); +void ena(int (*dio)(int tria)); + // CHECK: EnumDecl=Baz:3:6 (Definition)linkage=External // CHECK: EnumConstantDecl=Qux:3:12 (Definition)linkage=External // CHECK: VarDecl=x:4:5linkage=External @@ -22,5 +24,7 @@ static int wibble(int); // CHECK: VarDecl=k:9:7 (Definition)linkage=NoLinkage // CHECK: VarDecl=n:11:12linkage=External // CHECK: FunctionDecl=wibble:12:12linkage=Internal -// CHECL: ParmDecl=:12:22 (Definition)linkage=NoLinkage - +// CHECK: ParmDecl=:12:22 (Definition)linkage=NoLinkage +// CHECK: FunctionDecl=ena:14:6linkage=External +// CHECK: ParmDecl=dio:14:16 (Definition)linkage=NoLinkage +// CHECK: ParmDecl=tria:14:25 (Definition)linkage=NoLinkage diff --git a/test/Index/local-symbols.m b/test/Index/local-symbols.m index 01c8305c2af3..b4eb262583a9 100644 --- a/test/Index/local-symbols.m +++ b/test/Index/local-symbols.m @@ -29,10 +29,10 @@ // CHECK: local-symbols.m:6:12: ObjCInterfaceDecl=Foo:6:12 Extent=[6:1 - 10:5] // CHECK: local-symbols.m:7:6: ObjCIvarDecl=x:7:6 (Definition) Extent=[7:3 - 7:7] // CHECK: local-symbols.m:7:3: TypeRef=id:0:0 Extent=[7:3 - 7:5] -// CHECK: local-symbols.m:9:1: ObjCInstanceMethodDecl=bar:9:1 Extent=[9:1 - 9:12] +// CHECK: local-symbols.m:9:8: ObjCInstanceMethodDecl=bar:9:8 Extent=[9:1 - 9:12] // CHECK: local-symbols.m:9:4: TypeRef=id:0:0 Extent=[9:4 - 9:6] // CHECK: local-symbols.m:12:17: ObjCImplementationDecl=Foo:12:17 (Definition) Extent=[12:1 - 16:2] -// CHECK: local-symbols.m:13:1: ObjCInstanceMethodDecl=bar:13:1 (Definition) [Overrides @9:1] Extent=[13:1 - 15:2] +// CHECK: local-symbols.m:13:8: ObjCInstanceMethodDecl=bar:13:8 (Definition) Extent=[13:1 - 15:2] // CHECK: local-symbols.m:13:4: TypeRef=id:0:0 Extent=[13:4 - 13:6] // CHECK: local-symbols.m:14:10: UnexposedExpr= Extent=[14:10 - 14:11] // CHECK: local-symbols.m:14:10: IntegerLiteral= Extent=[14:10 - 14:11] diff --git a/test/Index/ms-if-exists.cpp b/test/Index/ms-if-exists.cpp new file mode 100644 index 000000000000..0815a037b15d --- /dev/null +++ b/test/Index/ms-if-exists.cpp @@ -0,0 +1,24 @@ +template<typename T> +void f(T t) { + __if_exists(T::foo) { + { } + t.foo(); + } + + __if_not_exists(T::bar) { + int *i = t; // expected-error{{no viable conversion from 'HasFoo' to 'int *'}} + { } + } +} + +// RUN: c-index-test -test-annotate-tokens=%s:3:1:11:3 -fms-extensions -fno-ms-compatibility -fno-delayed-template-parsing %s | FileCheck %s + +// CHECK: Identifier: "T" [3:15 - 3:16] TypeRef=T:1:19 +// CHECK: Punctuation: "}" [4:7 - 4:8] CompoundStmt= +// CHECK: Identifier: "t" [5:5 - 5:6] DeclRefExpr=t:2:10 +// CHECK: Punctuation: "." [5:6 - 5:7] MemberRefExpr= +// CHECK: Identifier: "foo" [5:7 - 5:10] MemberRefExpr= +// CHECK: Keyword: "int" [9:5 - 9:8] VarDecl=i:9:10 (Definition) +// CHECK: Punctuation: "*" [9:9 - 9:10] VarDecl=i:9:10 (Definition) +// CHECK: Identifier: "i" [9:10 - 9:11] VarDecl=i:9:10 (Definition) +// CHECK: Punctuation: "=" [9:12 - 9:13] VarDecl=i:9:10 (Definition) diff --git a/test/Index/nested-macro-instantiations.cpp b/test/Index/nested-macro-instantiations.cpp deleted file mode 100644 index 0ed84dd00800..000000000000 --- a/test/Index/nested-macro-instantiations.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#define FOO(x) x -#define BAR(x) FOO(x) -#define WIBBLE(x) BAR(x) - -WIBBLE(int x); - -// RUN: env CINDEXTEST_NESTED_MACROS=1 c-index-test -test-load-source all %s | FileCheck -check-prefix CHECK-WITH-NESTED %s -// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_NESTED_MACROS=1 c-index-test -test-load-source all %s | FileCheck -check-prefix CHECK-WITH-NESTED %s -// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_NESTED_MACROS=1 c-index-test -test-load-source-reparse 5 all %s | FileCheck -check-prefix CHECK-WITH-NESTED %s -// CHECK-WITH-NESTED: nested-macro-instantiations.cpp:5:1: macro expansion=WIBBLE:3:9 Extent=[5:1 - 5:14] -// CHECK-WITH-NESTED: nested-macro-instantiations.cpp:3:19: macro expansion=BAR:2:9 Extent=[3:19 - 5:14] -// CHECK-WITH-NESTED: nested-macro-instantiations.cpp:2:16: macro expansion=FOO:1:9 Extent=[2:16 - 5:14] -// CHECK-WITH-NESTED: nested-macro-instantiations.cpp:5:1: VarDecl=x:5:1 (Definition) Extent=[5:1 - 5:14] - -// RUN: c-index-test -test-load-source all %s | FileCheck -check-prefix CHECK-WITHOUT-NESTED %s -// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source all %s | FileCheck -check-prefix CHECK-WITHOUT-NESTED %s -// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 all %s | FileCheck -check-prefix CHECK-WITHOUT-NESTED %s -// CHECK-WITHOUT-NESTED: nested-macro-instantiations.cpp:5:1: macro expansion=WIBBLE:3:9 Extent=[5:1 - 5:14] -// CHECK-WITHOUT-NESTED-NOT: nested-macro-instantiations.cpp:3:19: macro expansion=BAR:2:9 Extent=[3:19 - 5:14] -// CHECK-WITHOUT-NESTED: nested-macro-instantiations.cpp:5:1: VarDecl=x:5:1 (Definition) Extent=[5:1 - 5:14] diff --git a/test/Index/overrides.m b/test/Index/overrides.m index 2197aaaa3672..690875456371 100644 --- a/test/Index/overrides.m +++ b/test/Index/overrides.m @@ -14,6 +14,7 @@ @interface A - (void)method; +- (void)protoMethod; + (void)methodWithParam:(int)param; @end @@ -27,9 +28,34 @@ + (void)methodWithParam:(int)param { } @end +@protocol P4 <P3> +- (void)protoMethod; +@end + +@interface B(cat) <P4> +- (void)protoMethod; +@end + +@interface B2 +@end + +@interface B2(cat) +-(void)meth; +@end + +@interface I2 : B2 +@end + +@implementation I2 +-(void)meth { } +@end + // RUN: c-index-test -test-load-source local %s | FileCheck %s -// CHECK: overrides.m:12:1: ObjCInstanceMethodDecl=protoMethod:12:1 [Overrides @3:1] Extent=[12:1 - 12:21] -// CHECK: overrides.m:21:1: ObjCInstanceMethodDecl=method:21:1 [Overrides @16:1] Extent=[21:1 - 21:16] -// CHECK: overrides.m:22:1: ObjCInstanceMethodDecl=protoMethod:22:1 [Overrides @12:1, @8:1] Extent=[22:1 - 22:21] -// CHECK: overrides.m:26:1: ObjCInstanceMethodDecl=method:26:1 (Definition) [Overrides @21:1] Extent=[26:1 - 26:19] -// CHECK: overrides.m:27:1: ObjCClassMethodDecl=methodWithParam::27:1 (Definition) [Overrides @17:1] Extent=[27:1 - 27:39] +// CHECK: overrides.m:12:9: ObjCInstanceMethodDecl=protoMethod:12:9 [Overrides @3:9] +// CHECK: overrides.m:22:9: ObjCInstanceMethodDecl=method:22:9 [Overrides @16:9] +// CHECK: overrides.m:23:9: ObjCInstanceMethodDecl=protoMethod:23:9 [Overrides @12:9, @8:9, @32:9, @17:9] +// CHECK: overrides.m:27:9: ObjCInstanceMethodDecl=method:27:9 (Definition) [Overrides @16:9] +// CHECK: overrides.m:28:9: ObjCClassMethodDecl=methodWithParam::28:9 (Definition) [Overrides @18:9] +// CHECK: overrides.m:32:9: ObjCInstanceMethodDecl=protoMethod:32:9 [Overrides @8:9] +// CHECK: overrides.m:36:9: ObjCInstanceMethodDecl=protoMethod:36:9 [Overrides @12:9, @8:9, @32:9, @17:9] +// CHECK: overrides.m:50:8: ObjCInstanceMethodDecl=meth:50:8 (Definition) [Overrides @43:8] diff --git a/test/Index/pch-opaque-value.cpp b/test/Index/pch-opaque-value.cpp new file mode 100644 index 000000000000..ae6b6dc58853 --- /dev/null +++ b/test/Index/pch-opaque-value.cpp @@ -0,0 +1,16 @@ +struct S { + S(); + S(int); + S(const S &); + ~S(); +}; + +void f() { + try { + } catch (S e) { + } +} + +// RUN: c-index-test -write-pch %t.pch %s +// RUN: c-index-test -test-load-tu-usrs %t.pch local | FileCheck %s +// CHECK: pch-opaque-value.cpp c:pch-opaque-value.cpp@86@F@f#@e Extent=[10:12 - 10:15] diff --git a/test/Index/pch-with-errors.c b/test/Index/pch-with-errors.c new file mode 100644 index 000000000000..be8728eb723b --- /dev/null +++ b/test/Index/pch-with-errors.c @@ -0,0 +1,42 @@ +#ifndef HEADER +#define HEADER + +#include "blahblah.h" +void erroneous(int); +void erroneous(float); + +struct bar; +struct zed { + bar g; +}; +struct baz { + zed h; +}; + +void errparm(zed e); + +struct S { + { +; + +#else + +void foo(void) { + erroneous(0); +} + +#endif + +// RUN: c-index-test -write-pch %t.h.pch %s -Xclang -detailed-preprocessing-record +// RUN: c-index-test -test-load-source local %s -include %t.h -Xclang -detailed-preprocessing-record | FileCheck -check-prefix=CHECK-PARSE %s +// RUN: c-index-test -index-file %s -include %t.h -Xclang -detailed-preprocessing-record | FileCheck -check-prefix=CHECK-INDEX %s + +// CHECK-PARSE: pch-with-errors.c:{{.*}}:6: FunctionDecl=foo +// CHECK-PARSE: pch-with-errors.c:{{.*}}:3: CallExpr=erroneous + +// CHECK-INDEX: [indexDeclaration]: kind: function | name: foo +// CHECK-INDEX: [indexEntityReference]: kind: function | name: erroneous + +// RUN: %clang -fsyntax-only %s -include %t.h 2>&1 | FileCheck -check-prefix=PCH-ERR %s + +// PCH-ERR: error: PCH file contains compiler errors diff --git a/test/Index/pch-with-errors.m b/test/Index/pch-with-errors.m new file mode 100644 index 000000000000..cc42cd308141 --- /dev/null +++ b/test/Index/pch-with-errors.m @@ -0,0 +1,28 @@ +#ifndef HEADER +#define HEADER + +@interface I(cat) +-(void)meth; +@end + +@interface I2 +-(void)meth; +@end + +#else + +void foo(I2 *i) { + [i meth]; +} + +#endif + +// RUN: c-index-test -write-pch %t.h.pch %s -Xclang -detailed-preprocessing-record +// RUN: c-index-test -test-load-source local %s -include %t.h -Xclang -detailed-preprocessing-record | FileCheck -check-prefix=CHECK-PARSE %s +// RUN: c-index-test -index-file %s -include %t.h -Xclang -detailed-preprocessing-record | FileCheck -check-prefix=CHECK-INDEX %s + +// CHECK-PARSE: pch-with-errors.m:{{.*}} FunctionDecl=foo +// CHECK-PARSE: pch-with-errors.m:{{.*}} ObjCMessageExpr=meth + +// CHECK-INDEX: [indexDeclaration]: kind: function | name: foo +// CHECK-INDEX: [indexEntityReference]: kind: objc-instance-method | name: meth diff --git a/test/Index/pragma-diag-reparse.c b/test/Index/pragma-diag-reparse.c index efe59b177841..71d0618d7092 100644 --- a/test/Index/pragma-diag-reparse.c +++ b/test/Index/pragma-diag-reparse.c @@ -1,13 +1,20 @@ -// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 local %s | FileCheck %s +#pragma clang diagnostic ignored "-Wtautological-compare" +#include "pragma_disable_warning.h" int main (int argc, const char * argv[]) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - int x; + int x=0; #pragma clang diagnostic pop - return 0; + return x; } -// CHECK: pragma-diag-reparse.c:7:7: VarDecl=x:7:7 (Definition) Extent=[7:3 - 7:8] +void foo() { int b=0; while (b==b); } + +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source-reparse 5 local \ +// RUN: -I%S/Inputs \ +// RUN: %s -Wall -Werror | FileCheck %s + +// CHECK: pragma-diag-reparse.c:8:7: VarDecl=x:8:7 (Definition) Extent=[8:3 - 8:10] diff --git a/test/Index/preamble-reparse-import.m b/test/Index/preamble-reparse-import.m new file mode 100644 index 000000000000..9bdb89a1dc50 --- /dev/null +++ b/test/Index/preamble-reparse-import.m @@ -0,0 +1,12 @@ +// RUN: c-index-test -write-pch %t.h.pch -x objective-c %s-2.h +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_FAILONERROR=1 \ +// RUN: c-index-test -test-load-source-reparse 3 local %s -include %t.h +// RUN: c-index-test -write-pch %t.h.pch -x objective-c %s-3.h +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_FAILONERROR=1 \ +// RUN: c-index-test -test-load-source-reparse 3 local %s -include %t.h + +#import "preamble-reparse-import.m-1.h" + +void foo(); +#import "preamble-reparse-import.m-2.h" +#import "preamble-reparse-import.m-1.h" diff --git a/test/Index/preamble-reparse-import.m-1.h b/test/Index/preamble-reparse-import.m-1.h new file mode 100644 index 000000000000..0d15823481d1 --- /dev/null +++ b/test/Index/preamble-reparse-import.m-1.h @@ -0,0 +1,5 @@ +#ifdef PARSED2 +#error parsed twice +#endif + +#define PARSED2 1 diff --git a/test/Index/preamble-reparse-import.m-2.h b/test/Index/preamble-reparse-import.m-2.h new file mode 100644 index 000000000000..8acc5c38c33d --- /dev/null +++ b/test/Index/preamble-reparse-import.m-2.h @@ -0,0 +1,5 @@ +#ifdef PARSED +#error parsed twice +#endif + +#define PARSED 1 diff --git a/test/Index/preamble-reparse-import.m-3.h b/test/Index/preamble-reparse-import.m-3.h new file mode 100644 index 000000000000..5369c1bec50d --- /dev/null +++ b/test/Index/preamble-reparse-import.m-3.h @@ -0,0 +1 @@ +#import "preamble-reparse-import.m-2.h" diff --git a/test/Index/print-typekind.c b/test/Index/print-typekind.c index c6583dbff38b..294aea77ed71 100644 --- a/test/Index/print-typekind.c +++ b/test/Index/print-typekind.c @@ -10,7 +10,7 @@ typedef int ArrayType[5]; // RUN: c-index-test -test-print-typekind %s | FileCheck %s // CHECK: TypedefDecl=FooType:1:13 (Definition) typekind=Typedef [canonical=Int] [isPOD=1] // CHECK: VarDecl=p:2:6 typekind=Pointer [isPOD=1] -// CHECK: FunctionDecl=f:3:6 (Definition) typekind=FunctionProto [canonical=FunctionProto] [result=Pointer] [isPOD=0] +// CHECK: FunctionDecl=f:3:6 (Definition) typekind=FunctionProto [canonical=FunctionProto] [result=Pointer] [args= Pointer Pointer Typedef] [isPOD=0] // CHECK: ParmDecl=p:3:13 (Definition) typekind=Pointer [isPOD=1] // CHECK: ParmDecl=x:3:22 (Definition) typekind=Pointer [isPOD=1] // CHECK: ParmDecl=z:3:33 (Definition) typekind=Typedef [canonical=Int] [isPOD=1] diff --git a/test/Index/print-typekind.m b/test/Index/print-typekind.m index 68827fb7ca6e..9db192938f44 100644 --- a/test/Index/print-typekind.m +++ b/test/Index/print-typekind.m @@ -1,10 +1,10 @@ @interface Foo @property (readonly) id x; -(int) mymethod; +-(int) mymethod2:(int)x blah:(float)y; @end // RUN: c-index-test -test-print-typekind %s | FileCheck %s // CHECK: ObjCPropertyDecl=x:2:25 typekind=Typedef [canonical=ObjCObjectPointer] -// CHECK: ObjCInstanceMethodDecl=mymethod:3:1 typekind=Invalid [result=Int] - - +// CHECK: ObjCInstanceMethodDecl=mymethod:3:8 typekind=Invalid [result=Int] +// CHECK: ObjCInstanceMethodDecl=mymethod2:blah::4:8 typekind=Invalid [result=Int] [args= Int Float] diff --git a/test/Index/properties-class-extensions.m b/test/Index/properties-class-extensions.m index 7b1e90fcd6fe..aa992075c669 100644 --- a/test/Index/properties-class-extensions.m +++ b/test/Index/properties-class-extensions.m @@ -58,7 +58,7 @@ // CHECK: properties-class-extensions.m:9:15: ObjCInstanceMethodDecl=b:9:15 Extent=[9:15 - 9:16] // CHECK: properties-class-extensions.m:9:15: ObjCInstanceMethodDecl=setB::9:15 Extent=[9:15 - 9:16] // CHECK: properties-class-extensions.m:9:15: ParmDecl=b:9:15 (Definition) Extent=[9:15 - 9:16] -// CHECK: properties-class-extensions.m:10:1: ObjCInstanceMethodDecl=bar:10:1 Extent=[10:1 - 10:14] +// CHECK: properties-class-extensions.m:10:10: ObjCInstanceMethodDecl=bar:10:10 Extent=[10:1 - 10:14] // CHECK: properties-class-extensions.m:15:12: ObjCInterfaceDecl=Bar:15:12 Extent=[15:1 - 17:5] // CHECK: properties-class-extensions.m:16:25: ObjCPropertyDecl=bar:16:25 Extent=[16:1 - 16:28] // CHECK: properties-class-extensions.m:16:22: TypeRef=id:0:0 Extent=[16:22 - 16:24] @@ -70,7 +70,7 @@ // CHECK-NOT: properties-class-extensions.m:16:25: ObjCInstanceMethodDecl=bar:16:25 Extent=[16:25 - 16:28] // CHECK: properties-class-extensions.m:19:26: ObjCInstanceMethodDecl=setBar::19:26 Extent=[19:26 - 19:29] // CHECK: properties-class-extensions.m:19:26: ParmDecl=bar:19:26 (Definition) Extent=[19:26 - 19:29] -// CHECK: properties-class-extensions.m:24:1: UnexposedDecl=[24:8] Extent=[24:1 - 24:23] +// CHECK: properties-class-extensions.m:24:8: ObjCInterfaceDecl=Rdar8467189_Bar:24:8 Extent=[24:1 - 24:23] // CHECK: properties-class-extensions.m:24:8: ObjCClassRef=Rdar8467189_Bar:24:8 Extent=[24:8 - 24:23] // CHECK: properties-class-extensions.m:25:11: ObjCProtocolDecl=Rdar8467189_FooProtocol:25:11 (Definition) Extent=[25:1 - 27:5] // CHECK: properties-class-extensions.m:26:39: ObjCPropertyDecl=Rdar8467189_Bar:26:39 Extent=[26:1 - 26:54] diff --git a/test/Index/recursive-cxx-member-calls.cpp b/test/Index/recursive-cxx-member-calls.cpp index adaaae9cdd19..b80cbf40e87c 100644 --- a/test/Index/recursive-cxx-member-calls.cpp +++ b/test/Index/recursive-cxx-member-calls.cpp @@ -933,7 +933,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: ")" [102:58 - 102:59] CallExpr=endswith:56:8 // CHECK-tokens: Punctuation: ")" [102:59 - 102:60] IfStmt= // CHECK-tokens: Identifier: "AttrName" [103:5 - 103:13] DeclRefExpr=AttrName:101:19 -// CHECK-tokens: Punctuation: "=" [103:14 - 103:15] CallExpr=operator=:38:7 +// CHECK-tokens: Punctuation: "=" [103:14 - 103:15] DeclRefExpr=operator=:38:7 // CHECK-tokens: Identifier: "AttrName" [103:16 - 103:24] DeclRefExpr=AttrName:101:19 // CHECK-tokens: Punctuation: "." [103:24 - 103:25] MemberRefExpr=substr:60:13 // CHECK-tokens: Identifier: "substr" [103:25 - 103:31] MemberRefExpr=substr:60:13 diff --git a/test/Index/redeclarations.cpp b/test/Index/redeclarations.cpp new file mode 100644 index 000000000000..11dc9320430c --- /dev/null +++ b/test/Index/redeclarations.cpp @@ -0,0 +1,21 @@ +#include "redeclarations.h" + +class A +{ +}; + +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 2 all -I%S/Inputs -fno-delayed-template-parsing -fno-ms-compatibility -fno-ms-extensions %s | FileCheck %s + +// CHECK: redeclarations.h:1:7: ClassDecl=X:1:7 (Definition) Extent=[1:1 - 4:2] +// CHECK: redeclarations.h:8:7: ClassTemplate=B:8:7 (Definition) Extent=[7:1 - 10:2] +// CHECK: redeclarations.h:7:20: TemplateTypeParameter=T1:7:20 (Definition) Extent=[7:11 - 7:22] +// CHECK: redeclarations.h:7:33: TemplateTypeParameter=T2:7:33 (Definition) Extent=[7:24 - 7:35] +// CHECK: redeclarations.h:13:8: ClassTemplate=C:13:8 (Definition) Extent=[12:1 - 15:2] +// CHECK: redeclarations.h:12:17: TemplateTypeParameter=T:12:17 (Definition) Extent=[12:11 - 12:18] +// CHECK: redeclarations.h:17:7: ClassDecl=D:17:7 (Definition) Extent=[17:1 - 21:2] +// CHECK: redeclarations.h:19:16: ClassDecl=A:19:16 Extent=[19:10 - 19:17] +// CHECK: redeclarations.h:19:19: FieldDecl=x:19:19 (Definition) Extent=[19:5 - 19:20] +// CHECK: redeclarations.h:19:5: TemplateRef=B:8:7 Extent=[19:5 - 19:6] +// CHECK: redeclarations.h:19:7: TypeRef=class D:17:7 Extent=[19:7 - 19:8] +// CHECK: redeclarations.h:19:16: TypeRef=class A:3:7 Extent=[19:16 - 19:17] +// CHECK: redeclarations.cpp:3:7: ClassDecl=A:3:7 (Definition) Extent=[3:1 - 5:2] diff --git a/test/Index/reparse-instantiate.cpp b/test/Index/reparse-instantiate.cpp new file mode 100644 index 000000000000..84e58605c48f --- /dev/null +++ b/test/Index/reparse-instantiate.cpp @@ -0,0 +1,7 @@ +int main() +{ + return 0; +} + +// RUN: c-index-test -write-pch %t.pch -fno-delayed-template-parsing -x c++-header %S/Inputs/reparse-instantiate.h +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 local -fno-delayed-template-parsing -I %S/Inputs -include %t %s diff --git a/test/Index/retain-target-options.c b/test/Index/retain-target-options.c index d616bc225669..2fba476fb1ee 100644 --- a/test/Index/retain-target-options.c +++ b/test/Index/retain-target-options.c @@ -1,8 +1,8 @@ -// RUN: c-index-test -test-load-source all -ccc-host-triple x86_64-apple-darwin10.0.0 -msse4.1 %s 2>&1 | FileCheck %s -// RUN: c-index-test -test-load-source-reparse 1 all -ccc-host-triple x86_64-apple-darwin10.0.0 -msse4.1 %s 2>&1 | FileCheck %s -// RUN: c-index-test -test-load-source-reparse 5 all -ccc-host-triple x86_64-apple-darwin10.0.0 -msse4.1 %s 2>&1 | FileCheck %s +// RUN: c-index-test -test-load-source all -target x86_64-apple-darwin10.0.0 -msse4.1 %s 2>&1 | FileCheck %s +// RUN: c-index-test -test-load-source-reparse 1 all -target x86_64-apple-darwin10.0.0 -msse4.1 %s 2>&1 | FileCheck %s +// RUN: c-index-test -test-load-source-reparse 5 all -target x86_64-apple-darwin10.0.0 -msse4.1 %s 2>&1 | FileCheck %s -// CHECK: error: #error SSE4_1 used +// CHECK: error: SSE4_1 used #if defined(__SSE4_1__) #error SSE4_1 used #endif diff --git a/test/Index/targeted-annotation.c b/test/Index/targeted-annotation.c new file mode 100644 index 000000000000..cfa1046cc8cf --- /dev/null +++ b/test/Index/targeted-annotation.c @@ -0,0 +1,99 @@ + +#include "targeted-top.h" +#include "targeted-preamble.h" + +int LocalVar1; +int LocalVar2; + +// RUN: c-index-test -write-pch %t.h.pch %S/targeted-top.h +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -test-annotate-tokens=%s:1:1:7:1 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=LOCAL + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -test-annotate-tokens=%s:1:1:7:1 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=PreambleVar \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=LOCAL + +// LOCAL: Punctuation: "#" [2:1 - 2:2] inclusion directive=targeted-top.h +// LOCAL: Identifier: "include" [2:2 - 2:9] inclusion directive=targeted-top.h +// LOCAL: Literal: ""targeted-top.h"" [2:10 - 2:26] inclusion directive=targeted-top.h +// LOCAL: Punctuation: "#" [3:1 - 3:2] inclusion directive=targeted-preamble.h +// LOCAL: Identifier: "include" [3:2 - 3:9] inclusion directive=targeted-preamble.h +// LOCAL: Literal: ""targeted-preamble.h"" [3:10 - 3:31] inclusion directive=targeted-preamble.h +// LOCAL: Keyword: "int" [5:1 - 5:4] VarDecl=LocalVar1:5:5 +// LOCAL: Identifier: "LocalVar1" [5:5 - 5:14] VarDecl=LocalVar1:5:5 +// LOCAL: Punctuation: ";" [5:14 - 5:15] +// LOCAL: Keyword: "int" [6:1 - 6:4] VarDecl=LocalVar2:6:5 +// LOCAL: Identifier: "LocalVar2" [6:5 - 6:14] VarDecl=LocalVar2:6:5 +// LOCAL: Punctuation: ";" [6:14 - 6:15] + +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -test-annotate-tokens=%S/targeted-fields.h:1:1:4:1 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=FIELD + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -test-annotate-tokens=%S/targeted-fields.h:1:1:4:1 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=PreambleVar \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=FIELD + +// FIELD: Keyword: "int" [2:3 - 2:6] FieldDecl=z:2:7 (Definition) +// FIELD: Identifier: "z" [2:7 - 2:8] FieldDecl=z:2:7 (Definition) +// FIELD: Punctuation: ";" [2:8 - 2:9] StructDecl=:13:9 (Definition) +// FIELD: Keyword: "int" [3:3 - 3:6] FieldDecl=w:3:7 (Definition) +// FIELD: Identifier: "w" [3:7 - 3:8] FieldDecl=w:3:7 (Definition) +// FIELD: Punctuation: ";" [3:8 - 3:9] StructDecl=:13:9 (Definition) + +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -test-annotate-tokens=%S/targeted-nested1.h:1:1:3:1 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=NESTED + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -test-annotate-tokens=%S/targeted-nested1.h:1:1:3:1 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=PreambleVar \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=NESTED + +// NESTED: Keyword: "extern" [2:1 - 2:7] +// NESTED: Keyword: "int" [2:8 - 2:11] VarDecl=NestedVar1:2:12 +// NESTED: Identifier: "NestedVar1" [2:12 - 2:22] VarDecl=NestedVar1:2:12 +// NESTED: Punctuation: ";" [2:22 - 2:23] + +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -test-annotate-tokens=%S/targeted-top.h:1:1:12:1 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=vector_get_x \ +// RUN: | FileCheck %s -check-prefix=TOP + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -test-annotate-tokens=%S/targeted-top.h:1:1:12:1 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=PreambleVar \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=vector_get_x \ +// RUN: | FileCheck %s -check-prefix=TOP + +// TOP: Punctuation: "#" [2:1 - 2:2] preprocessing directive= +// TOP: Identifier: "ifndef" [2:2 - 2:8] preprocessing directive= +// TOP: Identifier: "TARGETED_TOP_H" [2:9 - 2:23] preprocessing directive= +// TOP: Punctuation: "#" [3:1 - 3:2] preprocessing directive= +// TOP: Identifier: "define" [3:2 - 3:8] preprocessing directive= +// TOP: Identifier: "TARGETED_TOP_H" [3:9 - 3:23] preprocessing directive= +// TOP: Punctuation: "#" [5:1 - 5:2] preprocessing directive= +// TOP: Identifier: "include" [5:2 - 5:9] preprocessing directive= +// TOP: Literal: ""targeted-nested1.h"" [5:10 - 5:30] preprocessing directive= +// TOP: Keyword: "enum" [7:1 - 7:5] EnumDecl=:7:1 (Definition) +// TOP: Punctuation: "{" [7:6 - 7:7] EnumDecl=:7:1 (Definition) +// TOP: Identifier: "VALUE" [8:3 - 8:8] EnumConstantDecl=VALUE:8:3 (Definition) +// TOP: Punctuation: "=" [8:9 - 8:10] EnumConstantDecl=VALUE:8:3 (Definition) +// TOP: Literal: "3" [8:11 - 8:12] IntegerLiteral= +// TOP: Punctuation: "}" [9:1 - 9:2] EnumDecl=:7:1 (Definition) +// TOP: Punctuation: ";" [9:2 - 9:3] +// TOP: Keyword: "extern" [11:1 - 11:7] +// TOP: Keyword: "int" [11:8 - 11:11] VarDecl=TopVar:11:12 +// TOP: Identifier: "TopVar" [11:12 - 11:18] VarDecl=TopVar:11:12 +// TOP: Punctuation: ";" [11:18 - 11:19] diff --git a/test/Index/targeted-cursor.c b/test/Index/targeted-cursor.c new file mode 100644 index 000000000000..7efc07fad798 --- /dev/null +++ b/test/Index/targeted-cursor.c @@ -0,0 +1,65 @@ + +#include "targeted-top.h" +#include "targeted-preamble.h" + +int LocalVar1; +int LocalVar2; + +// RUN: c-index-test -write-pch %t.h.pch %S/targeted-top.h +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%s:5:10 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=LOCAL-CURSOR1 + +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-top.h:11:15 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=vector_get_x \ +// RUN: | FileCheck %s -check-prefix=TOP-CURSOR1 + +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-nested1.h:2:16 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=NESTED-CURSOR1 + +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-fields.h:2:7 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=FIELD-CURSOR1 + +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-fields.h:1:1 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=FIELD-CURSOR2 + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -cursor-at=%s:5:10 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=PreambleVar \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=LOCAL-CURSOR1 + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -cursor-at=%S/targeted-top.h:11:15 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=PreambleVar \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=vector_get_x \ +// RUN: | FileCheck %s -check-prefix=TOP-CURSOR1 + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -cursor-at=%S/targeted-nested1.h:2:16 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=PreambleVar \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=NESTED-CURSOR1 + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -cursor-at=%S/targeted-preamble.h:2:15 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=PREAMBLE-CURSOR1 + +// LOCAL-CURSOR1: VarDecl=LocalVar1:5:5 +// TOP-CURSOR1: VarDecl=TopVar:11:12 +// NESTED-CURSOR1: VarDecl=NestedVar1:2:12 +// PREAMBLE-CURSOR1: VarDecl=PreambleVar:2:12 + +// FIELD-CURSOR1: FieldDecl=z:2:7 (Definition) +// FIELD-CURSOR2: StructDecl=:13:9 (Definition) diff --git a/test/Index/targeted-cursor.m b/test/Index/targeted-cursor.m new file mode 100644 index 000000000000..a53ebf6918e2 --- /dev/null +++ b/test/Index/targeted-cursor.m @@ -0,0 +1,6 @@ + +// rdar://10920009 +// RUN: c-index-test -write-pch %t.h.pch -target x86_64-apple-macosx10.7 -x objective-c-header %S/targeted-cursor.m.h -Xclang -detailed-preprocessing-record +// RUN: c-index-test -cursor-at=%S/targeted-cursor.m.h:5:13 %s -target x86_64-apple-macosx10.7 -include %t.h | FileCheck %s + +// CHECK: ObjCClassRef=I:2:12 diff --git a/test/Index/targeted-cursor.m.h b/test/Index/targeted-cursor.m.h new file mode 100644 index 000000000000..735c7bd08f26 --- /dev/null +++ b/test/Index/targeted-cursor.m.h @@ -0,0 +1,7 @@ + +@interface I + +-(void)mm:(void (^)(I*))block; +-(void)mm2:(I*)i; + +@end diff --git a/test/Index/targeted-fields.h b/test/Index/targeted-fields.h new file mode 100644 index 000000000000..7da57f3ef27c --- /dev/null +++ b/test/Index/targeted-fields.h @@ -0,0 +1,3 @@ + + int z; + int w; diff --git a/test/Index/targeted-file-refs.c b/test/Index/targeted-file-refs.c new file mode 100644 index 000000000000..195cd8604d1f --- /dev/null +++ b/test/Index/targeted-file-refs.c @@ -0,0 +1,59 @@ + +#include "targeted-top.h" +#include "targeted-preamble.h" + +extern int LocalVar; +int LocalVar; + +// RUN: c-index-test -write-pch %t.h.pch %S/targeted-top.h -Xclang -detailed-preprocessing-record +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -file-refs-at=%s:5:17 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=LOCAL + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -file-refs-at=%s:5:17 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=PreambleVar \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=LOCAL + +// LOCAL: VarDecl=LocalVar:5:12 +// LOCAL: VarDecl=LocalVar:5:12 =[5:12 - 5:20] +// LOCAL: VarDecl=LocalVar:6:5 =[6:5 - 6:13] + +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -file-refs-at=%S/targeted-top.h:14:7 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: | FileCheck %s -check-prefix=TOP + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -file-refs-at=%S/targeted-top.h:14:7 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=PreambleVar \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: | FileCheck %s -check-prefix=TOP + +// TOP: FieldDecl=x:14:7 (Definition) +// TOP: FieldDecl=x:14:7 (Definition) =[14:7 - 14:8] +// TOP: MemberRefExpr=x:14:7 SingleRefName=[20:13 - 20:14] RefName=[20:13 - 20:14] =[20:13 - 20:14] + +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -file-refs-at=%S/targeted-nested1.h:2:16 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=NESTED + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -file-refs-at=%S/targeted-nested1.h:2:16 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=PreambleVar \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=NESTED + +// NESTED: VarDecl=NestedVar1:2:12 +// NESTED: VarDecl=NestedVar1:2:12 =[2:12 - 2:22] + +// RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \ +// RUN: c-index-test -file-refs-at=%S/targeted-preamble.h:2:15 %s -include %t.h \ +// RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \ +// RUN: -Xclang -error-on-deserialized-decl=TopVar \ +// RUN: | FileCheck %s -check-prefix=PREAMBLE + +// PREAMBLE: VarDecl=PreambleVar:2:12 +// PREAMBLE: VarDecl=PreambleVar:2:12 =[2:12 - 2:23] diff --git a/test/Index/targeted-nested1.h b/test/Index/targeted-nested1.h new file mode 100644 index 000000000000..d5a019b6985c --- /dev/null +++ b/test/Index/targeted-nested1.h @@ -0,0 +1,2 @@ + +extern int NestedVar1; diff --git a/test/Index/targeted-preamble.h b/test/Index/targeted-preamble.h new file mode 100644 index 000000000000..19b953933f14 --- /dev/null +++ b/test/Index/targeted-preamble.h @@ -0,0 +1,2 @@ + +extern int PreambleVar; diff --git a/test/Index/targeted-top.h b/test/Index/targeted-top.h new file mode 100644 index 000000000000..0f3c97586e41 --- /dev/null +++ b/test/Index/targeted-top.h @@ -0,0 +1,24 @@ + +#ifndef TARGETED_TOP_H +#define TARGETED_TOP_H + +#include "targeted-nested1.h" + +enum { + VALUE = 3 +}; + +extern int TopVar; + +typedef struct { + int x; + int y; +#include "targeted-fields.h" +} Vector; + +static inline int vector_get_x(Vector v) { + int x = v.x; + return x; +} + +#endif diff --git a/test/Index/unmatched-braces.c b/test/Index/unmatched-braces.c new file mode 100644 index 000000000000..b994605d362a --- /dev/null +++ b/test/Index/unmatched-braces.c @@ -0,0 +1,9 @@ +void foo() { + int x; + if (x) { +} + +// RUN: c-index-test -cursor-at=%s:2:7 %s > %t +// RUN: FileCheck %s -input-file %t + +// CHECK: VarDecl=x:2:7 diff --git a/test/Index/unmatched-braces.m b/test/Index/unmatched-braces.m new file mode 100644 index 000000000000..84fe82a06672 --- /dev/null +++ b/test/Index/unmatched-braces.m @@ -0,0 +1,11 @@ +@implementation I +-(void)meth { + int x; + if (x) { +} +@end + +// RUN: c-index-test -cursor-at=%s:3:7 %s > %t +// RUN: FileCheck %s -input-file %t + +// CHECK: VarDecl=x:3:7 diff --git a/test/Index/usrs.m b/test/Index/usrs.m index 826abb53f37c..95a538825f8c 100644 --- a/test/Index/usrs.m +++ b/test/Index/usrs.m @@ -1,4 +1,4 @@ -// RUN: c-index-test -test-load-source-usrs all %s | FileCheck %s + static inline int my_helper(int x, int y) { return x + y; } @@ -80,6 +80,15 @@ int test_multi_declaration(void) { - (void)method; @end +@interface CWithExt2 +@end +@interface CWithExt2 () { + id var_ext; +} +@property (assign) id pro_ext; +@end + +// RUN: c-index-test -test-load-source-usrs all -target x86_64-apple-macosx10.7 %s | FileCheck %s // CHECK: usrs.m c:usrs.m@67@F@my_helper Extent=[3:1 - 3:60] // CHECK: usrs.m c:usrs.m@95@F@my_helper@x Extent=[3:29 - 3:34] // CHECK: usrs.m c:usrs.m@102@F@my_helper@y Extent=[3:36 - 3:41] @@ -137,6 +146,12 @@ int test_multi_declaration(void) { // CHECK: usrs.m c:usrs.m@980@F@test_multi_declaration@baz Extent=[74:25 - 74:32] // CHECK: usrs.m c:objc(pl)P1 Extent=[79:1 - 81:5] // CHECK: usrs.m c:objc(pl)P1(im)method Extent=[80:1 - 80:16] +// CHECK: usrs.m c:objc(cs)CWithExt2 Extent=[83:1 - 84:5] +// CHECK: usrs.m c:objc(ext)CWithExt2@usrs.m@1111 Extent=[85:1 - 89:5] +// CHECK: usrs.m c:objc(cs)CWithExt2@var_ext Extent=[86:3 - 86:13] +// CHECK: usrs.m c:objc(cs)CWithExt2(py)pro_ext Extent=[88:1 - 88:30] +// CHECK: usrs.m c:objc(cs)CWithExt2(im)pro_ext Extent=[88:23 - 88:30] +// CHECK: usrs.m c:objc(cs)CWithExt2(im)setPro_ext: Extent=[88:23 - 88:30] // RUN: c-index-test -test-load-source all %s | FileCheck -check-prefix=CHECK-source %s // CHECK-source: usrs.m:3:19: FunctionDecl=my_helper:3:19 (Definition) Extent=[3:1 - 3:60] @@ -165,16 +180,16 @@ int test_multi_declaration(void) { // CHECK-source: usrs.m:26:3: TypeRef=id:0:0 Extent=[26:3 - 26:5] // CHECK-source: usrs.m:27:6: ObjCIvarDecl=y:27:6 (Definition) Extent=[27:3 - 27:7] // CHECK-source: usrs.m:27:3: TypeRef=id:0:0 Extent=[27:3 - 27:5] -// CHECK-source: usrs.m:29:1: ObjCInstanceMethodDecl=godzilla:29:1 Extent=[29:1 - 29:17] +// CHECK-source: usrs.m:29:8: ObjCInstanceMethodDecl=godzilla:29:8 Extent=[29:1 - 29:17] // CHECK-source: usrs.m:29:4: TypeRef=id:0:0 Extent=[29:4 - 29:6] -// CHECK-source: usrs.m:30:1: ObjCClassMethodDecl=kingkong:30:1 Extent=[30:1 - 30:17] +// CHECK-source: usrs.m:30:8: ObjCClassMethodDecl=kingkong:30:8 Extent=[30:1 - 30:17] // CHECK-source: usrs.m:30:4: TypeRef=id:0:0 Extent=[30:4 - 30:6] // CHECK-source: usrs.m:31:15: ObjCPropertyDecl=d1:31:15 Extent=[31:1 - 31:17] // CHECK-source: usrs.m:31:15: ObjCInstanceMethodDecl=d1:31:15 Extent=[31:15 - 31:17] // CHECK-source: usrs.m:31:15: ObjCInstanceMethodDecl=setD1::31:15 Extent=[31:15 - 31:17] // CHECK-source: usrs.m:31:15: ParmDecl=d1:31:15 (Definition) Extent=[31:15 - 31:17] // CHECK-source: usrs.m:34:17: ObjCImplementationDecl=Foo:34:17 (Definition) Extent=[34:1 - 45:2] -// CHECK-source: usrs.m:35:1: ObjCInstanceMethodDecl=godzilla:35:1 (Definition) [Overrides @29:1] Extent=[35:1 - 39:2] +// CHECK-source: usrs.m:35:8: ObjCInstanceMethodDecl=godzilla:35:8 (Definition) Extent=[35:1 - 39:2] // CHECK-source: usrs.m:35:4: TypeRef=id:0:0 Extent=[35:4 - 35:6] // CHECK-source: usrs.m:35:17: CompoundStmt= Extent=[35:17 - 39:2] // CHECK-source: usrs.m:36:3: DeclStmt= Extent=[36:3 - 36:20] @@ -185,7 +200,7 @@ int test_multi_declaration(void) { // CHECK-source: usrs.m:38:3: ReturnStmt= Extent=[38:3 - 38:11] // CHECK-source: usrs.m:38:10: UnexposedExpr= Extent=[38:10 - 38:11] // CHECK-source: usrs.m:38:10: IntegerLiteral= Extent=[38:10 - 38:11] -// CHECK-source: usrs.m:40:1: ObjCClassMethodDecl=kingkong:40:1 (Definition) [Overrides @30:1] Extent=[40:1 - 43:2] +// CHECK-source: usrs.m:40:8: ObjCClassMethodDecl=kingkong:40:8 (Definition) Extent=[40:1 - 43:2] // CHECK-source: usrs.m:40:4: TypeRef=id:0:0 Extent=[40:4 - 40:6] // CHECK-source: usrs.m:40:17: CompoundStmt= Extent=[40:17 - 43:2] // CHECK-source: usrs.m:41:3: DeclStmt= Extent=[41:3 - 41:17] @@ -202,34 +217,34 @@ int test_multi_declaration(void) { // CHECK-source: usrs.m:49:32: ReturnStmt= Extent=[49:32 - 49:40] // CHECK-source: usrs.m:49:39: DeclRefExpr=x:49:27 Extent=[49:39 - 49:40] // CHECK-source: usrs.m:51:12: ObjCInterfaceDecl=CWithExt:51:12 Extent=[51:1 - 53:5] -// CHECK-source: usrs.m:52:1: ObjCInstanceMethodDecl=meth1:52:1 Extent=[52:1 - 52:14] +// CHECK-source: usrs.m:52:8: ObjCInstanceMethodDecl=meth1:52:8 Extent=[52:1 - 52:14] // CHECK-source: usrs.m:52:4: TypeRef=id:0:0 Extent=[52:4 - 52:6] // CHECK-source: usrs.m:54:12: ObjCCategoryDecl=:54:12 Extent=[54:1 - 56:5] // CHECK-source: usrs.m:54:12: ObjCClassRef=CWithExt:51:12 Extent=[54:12 - 54:20] -// CHECK-source: usrs.m:55:1: ObjCInstanceMethodDecl=meth2:55:1 Extent=[55:1 - 55:14] +// CHECK-source: usrs.m:55:8: ObjCInstanceMethodDecl=meth2:55:8 Extent=[55:1 - 55:14] // CHECK-source: usrs.m:55:4: TypeRef=id:0:0 Extent=[55:4 - 55:6] // CHECK-source: usrs.m:57:12: ObjCCategoryDecl=:57:12 Extent=[57:1 - 59:5] // CHECK-source: usrs.m:57:12: ObjCClassRef=CWithExt:51:12 Extent=[57:12 - 57:20] -// CHECK-source: usrs.m:58:1: ObjCInstanceMethodDecl=meth3:58:1 Extent=[58:1 - 58:14] +// CHECK-source: usrs.m:58:8: ObjCInstanceMethodDecl=meth3:58:8 Extent=[58:1 - 58:14] // CHECK-source: usrs.m:58:4: TypeRef=id:0:0 Extent=[58:4 - 58:6] // CHECK-source: usrs.m:60:12: ObjCCategoryDecl=Bar:60:12 Extent=[60:1 - 62:5] // CHECK-source: usrs.m:60:12: ObjCClassRef=CWithExt:51:12 Extent=[60:12 - 60:20] -// CHECK-source: usrs.m:61:1: ObjCInstanceMethodDecl=meth4:61:1 Extent=[61:1 - 61:14] +// CHECK-source: usrs.m:61:8: ObjCInstanceMethodDecl=meth4:61:8 Extent=[61:1 - 61:14] // CHECK-source: usrs.m:61:4: TypeRef=id:0:0 Extent=[61:4 - 61:6] // CHECK-source: usrs.m:63:17: ObjCImplementationDecl=CWithExt:63:17 (Definition) Extent=[63:1 - 67:2] -// CHECK-source: usrs.m:64:1: ObjCInstanceMethodDecl=meth1:64:1 (Definition) [Overrides @52:1] Extent=[64:1 - 64:27] +// CHECK-source: usrs.m:64:8: ObjCInstanceMethodDecl=meth1:64:8 (Definition) Extent=[64:1 - 64:27] // CHECK-source: usrs.m:64:4: TypeRef=id:0:0 Extent=[64:4 - 64:6] // CHECK-source: usrs.m:64:14: CompoundStmt= Extent=[64:14 - 64:27] // CHECK-source: usrs.m:64:16: ReturnStmt= Extent=[64:16 - 64:24] // CHECK-source: usrs.m:64:23: UnexposedExpr= Extent=[64:23 - 64:24] // CHECK-source: usrs.m:64:23: IntegerLiteral= Extent=[64:23 - 64:24] -// CHECK-source: usrs.m:65:1: ObjCInstanceMethodDecl=meth2:65:1 (Definition) [Overrides @55:1] Extent=[65:1 - 65:27] +// CHECK-source: usrs.m:65:8: ObjCInstanceMethodDecl=meth2:65:8 (Definition) Extent=[65:1 - 65:27] // CHECK-source: usrs.m:65:4: TypeRef=id:0:0 Extent=[65:4 - 65:6] // CHECK-source: usrs.m:65:14: CompoundStmt= Extent=[65:14 - 65:27] // CHECK-source: usrs.m:65:16: ReturnStmt= Extent=[65:16 - 65:24] // CHECK-source: usrs.m:65:23: UnexposedExpr= Extent=[65:23 - 65:24] // CHECK-source: usrs.m:65:23: IntegerLiteral= Extent=[65:23 - 65:24] -// CHECK-source: usrs.m:66:1: ObjCInstanceMethodDecl=meth3:66:1 (Definition) [Overrides @58:1] Extent=[66:1 - 66:27] +// CHECK-source: usrs.m:66:8: ObjCInstanceMethodDecl=meth3:66:8 (Definition) Extent=[66:1 - 66:27] // CHECK-source: usrs.m:66:4: TypeRef=id:0:0 Extent=[66:4 - 66:6] // CHECK-source: usrs.m:66:14: CompoundStmt= Extent=[66:14 - 66:27] // CHECK-source: usrs.m:66:16: ReturnStmt= Extent=[66:16 - 66:24] @@ -237,7 +252,7 @@ int test_multi_declaration(void) { // CHECK-source: usrs.m:66:23: IntegerLiteral= Extent=[66:23 - 66:24] // CHECK-source: usrs.m:68:17: ObjCCategoryImplDecl=Bar:68:17 (Definition) Extent=[68:1 - 70:2] // CHECK-source: usrs.m:68:17: ObjCClassRef=CWithExt:51:12 Extent=[68:17 - 68:25] -// CHECK-source: usrs.m:69:1: ObjCInstanceMethodDecl=meth4:69:1 (Definition) [Overrides @61:1] Extent=[69:1 - 69:27] +// CHECK-source: usrs.m:69:8: ObjCInstanceMethodDecl=meth4:69:8 (Definition) Extent=[69:1 - 69:27] // CHECK-source: usrs.m:69:4: TypeRef=id:0:0 Extent=[69:4 - 69:6] // CHECK-source: usrs.m:69:14: CompoundStmt= Extent=[69:14 - 69:27] // CHECK-source: usrs.m:69:16: ReturnStmt= Extent=[69:16 - 69:24] @@ -265,5 +280,5 @@ int test_multi_declaration(void) { // CHECK-source: usrs.m:76:3: ReturnStmt= Extent=[76:3 - 76:11] // CHECK-source: usrs.m:76:10: IntegerLiteral= Extent=[76:10 - 76:11] // CHECK-source: usrs.m:79:11: ObjCProtocolDecl=P1:79:11 (Definition) Extent=[79:1 - 81:5] -// CHECK-source: usrs.m:80:1: ObjCInstanceMethodDecl=method:80:1 Extent=[80:1 - 80:16] +// CHECK-source: usrs.m:80:9: ObjCInstanceMethodDecl=method:80:9 Extent=[80:1 - 80:16] diff --git a/test/Index/vector-types.c b/test/Index/vector-types.c new file mode 100644 index 000000000000..404e4a54d9a5 --- /dev/null +++ b/test/Index/vector-types.c @@ -0,0 +1,6 @@ +int __attribute__((vector_size(16))) x; +typedef int __attribute__((vector_size(16))) int4_t; + +// RUN: c-index-test -test-print-typekind %s | FileCheck %s +// CHECK: VarDecl=x:1:38 typekind=Vector [isPOD=1] +// CHECK: TypedefDecl=int4_t:2:46 (Definition) typekind=Typedef [canonical=Vector] [isPOD=1] diff --git a/test/Index/werror.c b/test/Index/werror.c index 150095d8599c..98b602a170c0 100644 --- a/test/Index/werror.c +++ b/test/Index/werror.c @@ -7,9 +7,6 @@ void fatal(int); void fatal(float); #endif -// CHECK-FATAL: translation errors - // RUN: c-index-test -write-pch %t.pch -Werror %s -// RUN: not c-index-test -write-pch %t.pch -DFATAL -Werror %s 2>%t.err -// RUN: FileCheck -check-prefix=CHECK-FATAL %s < %t.err +// RUN: c-index-test -write-pch %t.pch -DFATAL -Werror %s |