diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:02:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:02:28 +0000 |
commit | 7442d6faa2719e4e7d33a7021c406c5a4facd74d (patch) | |
tree | c72b9241553fc9966179aba84f90f17bfa9235c3 /test/Index | |
parent | b52119637f743680a99710ce5fdb6646da2772af (diff) |
Notes
Diffstat (limited to 'test/Index')
26 files changed, 626 insertions, 143 deletions
diff --git a/test/Index/Core/Inputs/sys/system-head.h b/test/Index/Core/Inputs/sys/system-head.h new file mode 100644 index 0000000000000..df0e39ed86137 --- /dev/null +++ b/test/Index/Core/Inputs/sys/system-head.h @@ -0,0 +1,36 @@ +// CHECK: [[@LINE+1]]:12 | class/ObjC | Base | [[Base_USR:.*]] | {{.*}} | Decl | rel: 0 +@interface Base +@end + +// CHECK: [[@LINE+1]]:11 | protocol/ObjC | Prot1 | [[Prot1_USR:.*]] | {{.*}} | Decl | rel: 0 +@protocol Prot1 +@end + +// CHECK: [[@LINE+3]]:11 | protocol/ObjC | Prot2 | [[Prot2_USR:.*]] | {{.*}} | Decl | rel: 0 +// CHECK: [[@LINE+2]]:17 | protocol/ObjC | Prot1 | [[Prot1_USR]] | {{.*}} | Ref,RelBase,RelCont | rel: 1 +// CHECK-NEXT: RelBase,RelCont | Prot2 | [[Prot2_USR]] +@protocol Prot2<Prot1> +@end + +// CHECK: [[@LINE+7]]:12 | class/ObjC | Sub | [[Sub_USR:.*]] | {{.*}} | Decl | rel: 0 +// CHECK: [[@LINE+6]]:18 | class/ObjC | Base | [[Base_USR]] | {{.*}} | Ref,RelBase,RelCont | rel: 1 +// CHECK-NEXT: RelBase,RelCont | Sub | [[Sub_USR]] +// CHECK: [[@LINE+4]]:23 | protocol/ObjC | Prot2 | [[Prot2_USR]] | {{.*}} | Ref,RelBase,RelCont | rel: 1 +// CHECK-NEXT: RelBase,RelCont | Sub | [[Sub_USR]] +// CHECK: [[@LINE+2]]:30 | protocol/ObjC | Prot1 | [[Prot1_USR]] | {{.*}} | Ref,RelBase,RelCont | rel: 1 +// CHECK-NEXT: RelBase,RelCont | Sub | [[Sub_USR]] +@interface Sub : Base<Prot2, Prot1> +// CHECK-NOT: [[@LINE+1]]:3 | class/ObjC | Sub | +-(Sub*)getit; +@end + +// CHECK: [[@LINE+1]]:7 | class/C++ | Cls | [[Cls_USR:.*]] | {{.*}} | Def | rel: 0 +class Cls {}; + +// CHECK: [[@LINE+3]]:7 | class/C++ | SubCls1 | [[SubCls1_USR:.*]] | {{.*}} | Def | rel: 0 +// CHECK: [[@LINE+2]]:24 | class/C++ | Cls | [[Cls_USR]] | {{.*}} | Ref,RelBase,RelCont | rel: 1 +// CHECK-NEXT: RelBase,RelCont | SubCls1 | [[SubCls1_USR]] +class SubCls1 : public Cls { + // CHECK-NOT: [[@LINE+1]]:3 | class/C++ | SubCls1 | + SubCls1 *f; +}; diff --git a/test/Index/Core/index-pch.c b/test/Index/Core/index-pch.c new file mode 100644 index 0000000000000..773cfc59077e6 --- /dev/null +++ b/test/Index/Core/index-pch.c @@ -0,0 +1,13 @@ +// RUN: c-index-test core -print-source-symbols -- %s | FileCheck %s +// RUN: %clang_cc1 -emit-pch %s -o %t.pch +// RUN: c-index-test core -print-source-symbols -module-file %t.pch | FileCheck %s + +// CHECK: [[@LINE+1]]:6 | function/C | test1 | [[TEST1_USR:.*]] | [[TEST1_CG:.*]] | Decl | rel: 0 +void test1(); + +// CHECK: [[@LINE+1]]:20 | function/C | test2 | [[TEST2_USR:.*]] | {{.*}} | Def | rel: 0 +static inline void test2() { + // CHECK: [[@LINE+2]]:3 | function/C | test1 | [[TEST1_USR]] | [[TEST1_CG]] | Ref,Call,RelCall,RelCont | rel: 1 + // CHECK-NEXT: RelCall,RelCont | test2 | [[TEST2_USR]] + test1(); +} diff --git a/test/Index/Core/index-source.cpp b/test/Index/Core/index-source.cpp index 68eafecf6795f..356d4a08de3a7 100644 --- a/test/Index/Core/index-source.cpp +++ b/test/Index/Core/index-source.cpp @@ -1,16 +1,46 @@ // RUN: c-index-test core -print-source-symbols -- %s -std=c++14 -target x86_64-apple-macosx10.7 | FileCheck %s -// CHECK: [[@LINE+1]]:7 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Def | rel: 0 +// CHECK: [[@LINE+1]]:7 | class/C++ | Cls | [[Cls_USR:.*]] | <no-cgname> | Def | rel: 0 class Cls { - // CHECK: [[@LINE+2]]:3 | constructor/C++ | Cls | c:@S@Cls@F@Cls#I# | __ZN3ClsC1Ei | Decl,RelChild | rel: 1 + // CHECK: [[@LINE+3]]:3 | constructor/C++ | Cls | c:@S@Cls@F@Cls#I# | __ZN3ClsC1Ei | Decl,RelChild | rel: 1 // CHECK-NEXT: RelChild | Cls | c:@S@Cls + // CHECK: [[@LINE+1]]:3 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont | rel: 1 Cls(int x); - // CHECK: [[@LINE+1]]:3 | constructor/cxx-copy-ctor/C++ | Cls | c:@S@Cls@F@Cls#&1$@S@Cls# | __ZN3ClsC1ERKS_ | Decl,RelChild | rel: 1 + // CHECK: [[@LINE+2]]:3 | constructor/cxx-copy-ctor/C++ | Cls | c:@S@Cls@F@Cls#&1$@S@Cls# | __ZN3ClsC1ERKS_ | Decl,RelChild | rel: 1 + // CHECK: [[@LINE+1]]:3 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont | rel: 1 Cls(const Cls &); - // CHECK: [[@LINE+1]]:3 | constructor/cxx-move-ctor/C++ | Cls | c:@S@Cls@F@Cls#&&$@S@Cls# | __ZN3ClsC1EOS_ | Decl,RelChild | rel: 1 + // CHECK: [[@LINE+2]]:3 | constructor/cxx-move-ctor/C++ | Cls | c:@S@Cls@F@Cls#&&$@S@Cls# | __ZN3ClsC1EOS_ | Decl,RelChild | rel: 1 + // CHECK: [[@LINE+1]]:3 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont | rel: 1 Cls(Cls &&); + + // CHECK: [[@LINE+2]]:3 | destructor/C++ | ~Cls | c:@S@Cls@F@~Cls# | __ZN3ClsD1Ev | Decl,RelChild | rel: 1 + // CHECK: [[@LINE+1]]:4 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont | rel: 1 + ~Cls(); }; +// CHECK: [[@LINE+3]]:7 | class/C++ | SubCls1 | [[SubCls1_USR:.*]] | <no-cgname> | Def | rel: 0 +// CHECK: [[@LINE+2]]:24 | class/C++ | Cls | [[Cls_USR]] | <no-cgname> | Ref,RelBase,RelCont | rel: 1 +// CHECK-NEXT: RelBase,RelCont | SubCls1 | [[SubCls1_USR]] +class SubCls1 : public Cls {}; +// CHECK: [[@LINE+1]]:13 | type-alias/C | ClsAlias | [[ClsAlias_USR:.*]] | <no-cgname> | Def | rel: 0 +typedef Cls ClsAlias; +// CHECK: [[@LINE+5]]:7 | class/C++ | SubCls2 | [[SubCls2_USR:.*]] | <no-cgname> | Def | rel: 0 +// CHECK: [[@LINE+4]]:24 | type-alias/C | ClsAlias | [[ClsAlias_USR]] | <no-cgname> | Ref,RelCont | rel: 1 +// CHECK-NEXT: RelCont | SubCls2 | [[SubCls2_USR]] +// CHECK: [[@LINE+2]]:24 | class/C++ | Cls | [[Cls_USR]] | <no-cgname> | Ref,Impl,RelBase,RelCont | rel: 1 +// CHECK-NEXT: RelBase,RelCont | SubCls2 | [[SubCls2_USR]] +class SubCls2 : public ClsAlias {}; + +Cls::Cls(int x) {} +// CHECK: [[@LINE-1]]:6 | constructor/C++ | Cls | c:@S@Cls@F@Cls#I# | __ZN3ClsC1Ei | Def,RelChild | rel: 1 +// CHECK: [[@LINE-2]]:1 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont | rel: 1 +// CHECK: [[@LINE-3]]:6 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont | rel: 1 + +Cls::~/*a comment*/Cls() {} +// CHECK: [[@LINE-1]]:6 | destructor/C++ | ~Cls | c:@S@Cls@F@~Cls# | __ZN3ClsD1Ev | Def,RelChild | rel: 1 +// CHECK: [[@LINE-2]]:1 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont | rel: 1 +// CHECK: [[@LINE-3]]:20 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont | rel: 1 + template <typename TemplArg> class TemplCls { // CHECK: [[@LINE-1]]:7 | class(Gen)/C++ | TemplCls | c:@ST>1#T@TemplCls | <no-cgname> | Def | rel: 0 @@ -23,6 +53,16 @@ public: TemplCls<int> gtv(0); // CHECK: [[@LINE-1]]:1 | class(Gen)/C++ | TemplCls | c:@ST>1#T@TemplCls | <no-cgname> | Ref,RelCont | rel: 1 +template<class T> +class Wrapper {}; +template<class T, class P> +class Wrapper<T(P)> {}; + +// CHECK: [[@LINE+1]]:6 | function/C | test1 | [[TEST1_USR:.*]] | [[TEST1_CG:.*]] | Decl | rel: 0 +void test1(Wrapper<void(int)> f); +// CHECK: [[@LINE+1]]:6 | function/C | test1 | [[TEST1_USR]] | [[TEST1_CG]] | Def | rel: 0 +void test1(Wrapper<void(int)> f) {} + template <typename T> class BT { struct KLR { diff --git a/test/Index/Core/index-source.m b/test/Index/Core/index-source.m index 880028df63104..f48891417f5fa 100644 --- a/test/Index/Core/index-source.m +++ b/test/Index/Core/index-source.m @@ -1,4 +1,5 @@ // RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s +// RUN: c-index-test core -print-source-symbols -include-locals -- %s -target x86_64-apple-macosx10.7 | FileCheck -check-prefix=LOCAL %s @interface Base // CHECK: [[@LINE-1]]:12 | class/ObjC | Base | c:objc(cs)Base | _OBJC_CLASS_$_Base | Decl | rel: 0 @@ -13,10 +14,33 @@ @end void foo(); -// CHECK: [[@LINE+3]]:6 | function/C | goo | c:@F@goo | _goo | Def | rel: 0 -// CHECK: [[@LINE+2]]:10 | class/ObjC | Base | c:objc(cs)Base | _OBJC_CLASS_$_Base | Ref,RelCont | rel: 1 +// CHECK: [[@LINE+6]]:6 | function/C | goo | c:@F@goo | _goo | Def | rel: 0 +// CHECK: [[@LINE+5]]:10 | class/ObjC | Base | c:objc(cs)Base | _OBJC_CLASS_$_Base | Ref,RelCont | rel: 1 // CHECK-NEXT: RelCont | goo | c:@F@goo +// CHECK-NOT: [[@LINE+3]]:16 | param +// LOCAL: [[@LINE+2]]:16 | param(local)/C | b | [[b_USR:c:.*]] | _b | Def,RelChild | rel: 1 +// LOCAL-NEXT: RelChild | goo | c:@F@goo void goo(Base *b) { + // CHECK-NOT: [[@LINE+6]]:7 | variable + // LOCAL: [[@LINE+5]]:7 | variable(local)/C | x | [[x_USR:c:.*]] | _x | Def,RelCont | rel: 1 + // LOCAL-NEXT: RelCont | goo | c:@F@goo + // CHECK-NOT: [[@LINE+3]]:11 | param + // LOCAL: [[@LINE+2]]:11 | param(local)/C | b | [[b_USR]] | _b | Ref,Read,RelCont | rel: 1 + // LOCAL-NEXT: RelCont | x | [[x_USR]] + int x = b; + // CHECK-NOT: [[@LINE+5]]:7 | variable + // LOCAL: [[@LINE+4]]:7 | variable(local)/C | y | [[y_USR:c:.*]] | _y | Def,RelCont | rel: 1 + // CHECK-NOT: [[@LINE+3]]:11 | variable + // LOCAL: [[@LINE+2]]:11 | variable(local)/C | x | [[x_USR]] | _x | Ref,Read,RelCont | rel: 1 + // LOCAL-NEXT: RelCont | y | [[y_USR]] + int y = x; + + // CHECK-NOT: [[@LINE+1]]:10 | struct + // LOCAL: [[@LINE+1]]:10 | struct(local)/C | Foo | c:{{.*}} | <no-cgname> | Def,RelCont | rel: 1 + struct Foo { + int i; + }; + // CHECK: [[@LINE+2]]:3 | function/C | foo | c:@F@foo | _foo | Ref,Call,RelCall,RelCont | rel: 1 // CHECK-NEXT: RelCall,RelCont | goo | c:@F@goo foo(); @@ -97,32 +121,79 @@ extern int setjmp(jmp_buf); @end @interface I2 +// CHECK: [[@LINE-1]]:12 | class/ObjC | I2 | [[I2_USR:.*]] | {{.*}} | Decl | rel: 0 + @property (readwrite) id prop; +// CHECK: [[@LINE-1]]:26 | instance-method/acc-get/ObjC | prop | [[I2_prop_getter_USR:.*]] | -[I2 prop] | Decl,Dyn,Impl,RelChild,RelAcc | rel: 2 +// CHECK: [[@LINE-2]]:26 | instance-method/acc-set/ObjC | setProp: | [[I2_prop_setter_USR:.*]] | -[I2 setProp:] | Decl,Dyn,Impl,RelChild,RelAcc | rel: 2 +// CHECK: [[@LINE-3]]:26 | instance-property/ObjC | prop | [[I2_prop_USR:.*]] | <no-cgname> | Decl,RelChild | rel: 1 -// CHECK: [[@LINE+4]]:63 | instance-property(IB,IBColl)/ObjC | buttons | c:objc(cs)I2(py)buttons | <no-cgname> | Decl,RelChild | rel: 1 -// CHECK-NEXT: RelChild | I2 | c:objc(cs)I2 +@property (readwrite, getter=customGet, setter=customSet:) id unrelated; +// CHECK: [[@LINE-1]]:30 | instance-method/acc-get/ObjC | customGet | {{.*}} | -[I2 customGet] | Decl,Dyn,RelChild,RelAcc | rel: 2 +// CHECK: [[@LINE-2]]:48 | instance-method/acc-set/ObjC | customSet: | {{.*}} | -[I2 customSet:] | Decl,Dyn,RelChild,RelAcc | rel: 2 +// CHECK: [[@LINE-3]]:63 | instance-property/ObjC | unrelated | {{.*}} | <no-cgname> | Decl,RelChild | rel: 1 + +-(id)declaredGet; +@property (readwrite, getter=declaredGet) id otherProp; +// CHECK: [[@LINE-1]]:30 | instance-method/acc-get/ObjC | declaredGet | {{.*}} | -[I2 declaredGet] | Ref,RelCont | rel: 1 +// CHECK: [[@LINE-3]]:6 | instance-method/acc-get/ObjC | declaredGet | {{.*}} | -[I2 declaredGet] | Decl,Dyn,RelChild,RelAcc | rel: 2 +// CHECK: [[@LINE-3]]:46 | instance-method/acc-set/ObjC | setOtherProp: | {{.*}} | -[I2 setOtherProp:] | Decl,Dyn,Impl,RelChild,RelAcc | rel: 2 + +// CHECK: [[@LINE+4]]:63 | instance-property(IB,IBColl)/ObjC | buttons | [[buttons_USR:.*]] | <no-cgname> | Decl,RelChild | rel: 1 +// CHECK-NEXT: RelChild | I2 | [[I2_USR]] // CHECK: [[@LINE+2]]:50 | class/ObjC | I1 | c:objc(cs)I1 | _OBJC_CLASS_$_I1 | Ref,RelCont,RelIBType | rel: 1 -// CHECK-NEXT: RelCont,RelIBType | buttons | c:objc(cs)I2(py)buttons +// CHECK-NEXT: RelCont,RelIBType | buttons | [[buttons_USR]] @property (nonatomic, strong) IBOutletCollection(I1) NSArray *buttons; @end -// CHECK: [[@LINE+2]]:17 | field/ObjC | _prop | c:objc(cs)I2@_prop | <no-cgname> | Def,Impl,RelChild | rel: 1 -// CHECK-NEXT: RelChild | I2 | c:objc(cs)I2 @implementation I2 -// CHECK: [[@LINE+6]]:13 | instance-property/ObjC | prop | c:objc(cs)I2(py)prop | <no-cgname> | Ref,RelCont | rel: 1 -// CHECK-NEXT: RelCont | I2 | c:objc(cs)I2 -// CHECK: [[@LINE+4]]:13 | instance-method/acc-get/ObjC | prop | c:objc(cs)I2(im)prop | -[I2 prop] | Def,RelChild | rel: 1 -// CHECK-NEXT: RelChild | I2 | c:objc(cs)I2 -// CHECK: [[@LINE+2]]:13 | instance-method/acc-set/ObjC | setProp: | c:objc(cs)I2(im)setProp: | -[I2 setProp:] | Def,RelChild | rel: 1 -// CHECK-NEXT: RelChild | I2 | c:objc(cs)I2 +// CHECK: [[@LINE+9]]:13 | instance-property/ObjC | prop | [[I2_prop_USR:.*]] | <no-cgname> | Def,RelChild,RelAcc | rel: 2 +// CHECK-NEXT: RelChild | I2 | [[I2_USR]] +// CHECK-NEXT: RelAcc | _prop | c:objc(cs)I2@_prop +// CHECK: [[@LINE+6]]:13 | instance-method/acc-get/ObjC | prop | [[I2_prop_getter_USR]] | -[I2 prop] | Def,Impl,RelChild | rel: 1 +// CHECK-NEXT: RelChild | I2 | [[I2_USR]] +// CHECK: [[@LINE+4]]:13 | instance-method/acc-set/ObjC | setProp: | [[I2_prop_setter_USR]] | -[I2 setProp:] | Def,Impl,RelChild | rel: 1 +// CHECK-NEXT: RelChild | I2 | [[I2_USR]] +// CHECK: [[@LINE+2]]:20 | field/ObjC | _prop | c:objc(cs)I2@_prop | <no-cgname> | Def,RelChild | rel: 1 +// CHECK-NEXT: RelChild | I2 | [[I2_USR]] @synthesize prop = _prop; -// CHECK: [[@LINE+5]]:12 | instance-method(IB)/ObjC | doAction:foo: | c:objc(cs)I2(im)doAction:foo: | -[I2 doAction:foo:] | Def,Dyn,RelChild | rel: 1 -// CHECK-NEXT: RelChild | I2 | c:objc(cs)I2 -// CHECK: [[@LINE+3]]:22 | class/ObjC | I1 | c:objc(cs)I1 | _OBJC_CLASS_$_I1 | Ref,RelCont,RelIBType | rel: 1 -// CHECK-NEXT: RelCont,RelIBType | doAction:foo: | c:objc(cs)I2(im)doAction:foo: -// CHECK: [[@LINE+1]]:39 | class/ObjC | I1 | c:objc(cs)I1 | _OBJC_CLASS_$_I1 | Ref,RelCont | rel: 1 --(IBAction)doAction:(I1 *)sender foo:(I1 *)bar {} +// CHECK: [[@LINE+11]]:12 | instance-method(IB)/ObjC | doAction:foo: | [[doAction_USR:.*]] | -[I2 doAction:foo:] | Def,Dyn,RelChild | rel: 1 +// CHECK-NEXT: RelChild | I2 | [[I2_USR]] +// CHECK: [[@LINE+9]]:22 | class/ObjC | I1 | c:objc(cs)I1 | _OBJC_CLASS_$_I1 | Ref,RelCont,RelIBType | rel: 1 +// CHECK-NEXT: RelCont,RelIBType | doAction:foo: | [[doAction_USR]] +// CHECK-NOT: [[@LINE+7]]:27 | param +// LOCAL: [[@LINE+6]]:27 | param(local)/C | sender | c:{{.*}} | _sender | Def,RelChild | rel: 1 +// LOCAL-NEXT: RelChild | doAction:foo: | [[doAction_USR:.*]] +// CHECK: [[@LINE+4]]:39 | class/ObjC | I1 | c:objc(cs)I1 | _OBJC_CLASS_$_I1 | Ref,RelCont | rel: 1 +// CHECK-NOT: [[@LINE+3]]:44 | param +// LOCAL: [[@LINE+2]]:44 | param(local)/C | bar | c:{{.*}} | _bar | Def,RelChild | rel: 1 +// LOCAL-NEXT: RelChild | doAction:foo: | [[doAction_USR]] +-(IBAction)doAction:(I1 *)sender foo:(I1 *)bar { + [self prop]; + // CHECK: [[@LINE-1]]:9 | instance-method/acc-get/ObjC | prop | [[I2_prop_getter_USR]] | -[I2 prop] | Ref,Call,Dyn,RelRec,RelCall,RelCont | rel: 2 + // CHECK-NEXT: RelCall,RelCont | doAction:foo: | [[doAction_USR]] + // CHECK-NEXT: RelRec | I2 | [[I2_USR]] + + [self setProp: bar]; + // CHECK: [[@LINE-1]]:9 | instance-method/acc-set/ObjC | setProp: | [[I2_prop_setter_USR]] | -[I2 setProp:] | Ref,Call,Dyn,RelRec,RelCall,RelCont | rel: 2 + // CHECK-NEXT: RelCall,RelCont | doAction:foo: | [[doAction_USR]] + // CHECK-NEXT: RelRec | I2 | [[I2_USR]] + + self.prop; + // CHECK: [[@LINE-1]]:8 | instance-property/ObjC | prop | [[I2_prop_USR]] | <no-cgname> | Ref,RelCont | rel: 1 + // CHECK-NEXT: RelCont | doAction:foo: | [[doAction_USR]] + // CHECK: [[@LINE-3]]:8 | instance-method/acc-get/ObjC | prop | [[I2_prop_getter_USR]] | -[I2 prop] | Ref,Call,Dyn,Impl,RelRec,RelCall,RelCont | rel: 2 + // CHECK-NEXT: RelCall,RelCont | doAction:foo: | [[doAction_USR]] + // CHECK-NEXT: RelRec | I2 | [[I2_USR]] + + self.prop = self.prop; + // CHECK: [[@LINE-1]]:8 | instance-property/ObjC | prop | [[I2_prop_USR]] | <no-cgname> | Ref,Writ,RelCont | rel: 1 + // CHECK-NEXT: RelCont | doAction:foo: | [[doAction_USR]] + // CHECK:[[@LINE-3]]:8 | instance-method/acc-set/ObjC | setProp: | [[I2_prop_setter_USR]] | -[I2 setProp:] | Ref,Call,Dyn,Impl,RelRec,RelCall,RelCont | rel: 2 + // CHECK-NEXT: RelCall,RelCont | doAction:foo: | [[doAction_USR]] + // CHECK-NEXT: RelRec | I2 | [[I2_USR]] +} @end @interface I3 @@ -131,18 +202,20 @@ extern int setjmp(jmp_buf); // CHECK-NEXT: RelChild | I3 | c:objc(cs)I3 // CHECK-NEXT: RelAcc | prop | c:objc(cs)I3(py)prop -(id)prop; -// CHECK: [[@LINE+3]]:8 | instance-method/acc-set/ObjC | setProp: | c:objc(cs)I3(im)setProp: | -[I3 setProp:] | Decl,Dyn,RelChild,RelAcc | rel: 2 +// CHECK: [[@LINE+4]]:8 | instance-method/acc-set/ObjC | setProp: | c:objc(cs)I3(im)setProp: | -[I3 setProp:] | Decl,Dyn,RelChild,RelAcc | rel: 2 // CHECK-NEXT: RelChild | I3 | c:objc(cs)I3 // CHECK-NEXT: RelAcc | prop | c:objc(cs)I3(py)prop +// LOCAL-NOT: [[@LINE+1]]:20 | param -(void)setProp:(id)p; @end // CHECK: [[@LINE+1]]:17 | class/ObjC | I3 | c:objc(cs)I3 | <no-cgname> | Def | rel: 0 @implementation I3 -// CHECK: [[@LINE+4]]:13 | instance-property/ObjC | prop | c:objc(cs)I3(py)prop | <no-cgname> | Ref,RelCont | rel: 1 -// CHECK-NEXT: RelCont | I3 | c:objc(cs)I3 -// CHECK: [[@LINE+2]]:13 | instance-method/acc-get/ObjC | prop | c:objc(cs)I3(im)prop | -[I3 prop] | Def,RelChild | rel: 1 -// CHECK: [[@LINE+1]]:13 | instance-method/acc-set/ObjC | setProp: | c:objc(cs)I3(im)setProp: | -[I3 setProp:] | Def,RelChild | rel: 1 +// CHECK: [[@LINE+5]]:13 | instance-property/ObjC | prop | c:objc(cs)I3(py)prop | <no-cgname> | Def,RelChild,RelAcc | rel: 2 +// CHECK-NEXT: RelChild | I3 | c:objc(cs)I3 +// CHECK-NEXT: RelAcc | _prop | c:objc(cs)I3@_prop +// CHECK: [[@LINE+2]]:13 | instance-method/acc-get/ObjC | prop | c:objc(cs)I3(im)prop | -[I3 prop] | Def,Impl,RelChild | rel: 1 +// CHECK: [[@LINE+1]]:13 | instance-method/acc-set/ObjC | setProp: | c:objc(cs)I3(im)setProp: | -[I3 setProp:] | Def,Impl,RelChild | rel: 1 @synthesize prop = _prop; @end @@ -155,7 +228,7 @@ extern int setjmp(jmp_buf); @end // CHECK: [[@LINE+2]]:17 | class/ObjC | I3 | c:objc(cs)I3 | _OBJC_CLASS_$_I3 | Ref,RelCont | rel: 1 -// CHECK: [[@LINE+1]]:20 | extension/ObjC | I3 | c:objc(cy)I3@bar | <no-cgname> | Def | rel: 0 +// CHECK: [[@LINE+1]]:20 | extension/ObjC | bar | c:objc(cy)I3@bar | <no-cgname> | Def | rel: 0 @implementation I3(bar) @end @@ -169,16 +242,145 @@ extern int setjmp(jmp_buf); @protocol MyEnumerating @end -// CHECK: [[@LINE+4]]:41 | type-alias/C | MyEnumerator | c:index-source.m@T@MyEnumerator | <no-cgname> | Def | rel: 0 +// CHECK: [[@LINE+4]]:41 | type-alias/C | MyEnumerator | [[MyEnumerator_USR:.*]] | <no-cgname> | Def | rel: 0 // CHECK: [[@LINE+3]]:26 | protocol/ObjC | MyEnumerating | c:objc(pl)MyEnumerating | <no-cgname> | Ref,RelCont | rel: 1 // CHECK: [[@LINE+2]]:9 | class/ObjC | MyGenCls | c:objc(cs)MyGenCls | _OBJC_CLASS_$_MyGenCls | Ref,RelCont | rel: 1 // CHECK: [[@LINE+1]]:18 | class/ObjC | Base | c:objc(cs)Base | _OBJC_CLASS_$_Base | Ref,RelCont | rel: 1 typedef MyGenCls<Base *><MyEnumerating> MyEnumerator; -// CHECK: [[@LINE+5]]:12 | class/ObjC | PermanentEnumerator | c:objc(cs)PermanentEnumerator | _OBJC_CLASS_$_PermanentEnumerator | Decl | rel: 0 -// CHECK: [[@LINE+4]]:34 | class/ObjC | MyGenCls | c:objc(cs)MyGenCls | _OBJC_CLASS_$_MyGenCls | Ref,RelBase,RelCont | rel: 1 -// CHECK-NEXT: RelBase,RelCont | PermanentEnumerator | c:objc(cs)PermanentEnumerator -// CHECK: [[@LINE+2]]:34 | protocol/ObjC | MyEnumerating | c:objc(pl)MyEnumerating | <no-cgname> | Ref,RelBase,RelCont | rel: 1 -// CHECK-NEXT: RelBase,RelCont | PermanentEnumerator | c:objc(cs)PermanentEnumerator +// CHECK: [[@LINE+7]]:12 | class/ObjC | PermanentEnumerator | [[PermanentEnumerator_USR:.*]] | _OBJC_CLASS_$_PermanentEnumerator | Decl | rel: 0 +// CHECK: [[@LINE+6]]:34 | type-alias/C | MyEnumerator | [[MyEnumerator_USR]] | <no-cgname> | Ref,RelCont | rel: 1 +// CHECK-NEXT: RelCont | PermanentEnumerator | [[PermanentEnumerator_USR]] +// CHECK: [[@LINE+4]]:34 | class/ObjC | MyGenCls | c:objc(cs)MyGenCls | _OBJC_CLASS_$_MyGenCls | Ref,Impl,RelBase,RelCont | rel: 1 +// CHECK-NEXT: RelBase,RelCont | PermanentEnumerator | [[PermanentEnumerator_USR]] +// CHECK: [[@LINE+2]]:34 | protocol/ObjC | MyEnumerating | c:objc(pl)MyEnumerating | <no-cgname> | Ref,Impl,RelBase,RelCont | rel: 1 +// CHECK-NEXT: RelBase,RelCont | PermanentEnumerator | [[PermanentEnumerator_USR]] @interface PermanentEnumerator : MyEnumerator @end + +// CHECK: [[@LINE+2]]:48 | protocol/ObjC | Prot1 | c:objc(pl)Prot1 | <no-cgname> | Ref,RelBase,RelCont | rel: 1 +// CHECK: [[@LINE+1]]:35 | protocol/ObjC | MyEnumerating | c:objc(pl)MyEnumerating | <no-cgname> | Ref,Impl,RelBase,RelCont | rel: 1 +@interface PermanentEnumerator2 : MyEnumerator<Prot1> +@end + +@interface I4 +@property id foo; +@end + +@implementation I4 { + id _blahfoo; // explicit def + // CHECK: [[@LINE-1]]:6 | field/ObjC | _blahfoo | c:objc(cs)I4@_blahfoo | <no-cgname> | Def,RelChild | rel: 1 +} +@synthesize foo = _blahfoo; // ref of field _blahfoo +// CHECK: [[@LINE-1]]:13 | instance-property/ObjC | foo | c:objc(cs)I4(py)foo | <no-cgname> | Def,RelChild,RelAcc | rel: 2 +// CHECK-NEXT: RelChild | I4 | c:objc(cs)I4 +// CHECK-NEXT: RelAcc | _blahfoo | c:objc(cs)I4@_blahfoo +// CHECK: [[@LINE-4]]:13 | instance-method/acc-get/ObjC | foo | c:objc(cs)I4(im)foo | -[I4 foo] | Def,Impl,RelChild | rel: 1 +// CHECK-NEXT: RelChild | I4 | c:objc(cs)I4 +// CHECK: [[@LINE-6]]:13 | instance-method/acc-set/ObjC | setFoo: | c:objc(cs)I4(im)setFoo: | -[I4 setFoo:] | Def,Impl,RelChild | rel: 1 +// CHECK-NEXT: RelChild | I4 | c:objc(cs)I4 +// CHECK: [[@LINE-8]]:19 | field/ObjC | _blahfoo | c:objc(cs)I4@_blahfoo | <no-cgname> | Ref | rel: 0 + +-(void)method { + _blahfoo = 0; + // CHECK: [[@LINE-1]]:3 | field/ObjC | _blahfoo | c:objc(cs)I4@_blahfoo | <no-cgname> | Ref,Writ,RelCont | rel: 1 +} +@end + +@interface I5 +@property id foo; +@end + +@implementation I5 +@synthesize foo = _blahfoo; // explicit def of field _blahfoo +// CHECK: [[@LINE-1]]:13 | instance-property/ObjC | foo | c:objc(cs)I5(py)foo | <no-cgname> | Def,RelChild,RelAcc | rel: 2 +// CHECK-NEXT: RelChild | I5 | c:objc(cs)I5 +// CHECK-NEXT: RelAcc | _blahfoo | c:objc(cs)I5@_blahfoo +// CHECK: [[@LINE-4]]:13 | instance-method/acc-get/ObjC | foo | c:objc(cs)I5(im)foo | -[I5 foo] | Def,Impl,RelChild | rel: 1 +// CHECK-NEXT: RelChild | I5 | c:objc(cs)I5 +// CHECK: [[@LINE-6]]:13 | instance-method/acc-set/ObjC | setFoo: | c:objc(cs)I5(im)setFoo: | -[I5 setFoo:] | Def,Impl,RelChild | rel: 1 +// CHECK-NEXT: RelChild | I5 | c:objc(cs)I5 +// CHECK: [[@LINE-8]]:19 | field/ObjC | _blahfoo | c:objc(cs)I5@_blahfoo | <no-cgname> | Def,RelChild | rel: 1 + +-(void)method { + _blahfoo = 0; + // CHECK: [[@LINE-1]]:3 | field/ObjC | _blahfoo | c:objc(cs)I5@_blahfoo | <no-cgname> | Ref,Writ,RelCont | rel: 1 +} +@end + +@interface I6 +@property id foo; +@end + +@implementation I6 +@synthesize foo; // implicit def of field foo +// CHECK: [[@LINE-1]]:13 | instance-property/ObjC | foo | c:objc(cs)I6(py)foo | <no-cgname> | Def,RelChild,RelAcc | rel: 2 +// CHECK-NEXT: RelChild | I6 | c:objc(cs)I6 +// CHECK-NEXT: RelAcc | foo | c:objc(cs)I6@foo +// CHECK: [[@LINE-4]]:13 | instance-method/acc-get/ObjC | foo | c:objc(cs)I6(im)foo | -[I6 foo] | Def,Impl,RelChild | rel: 1 +// CHECK-NEXT: RelChild | I6 | c:objc(cs)I6 +// CHECK: [[@LINE-6]]:13 | instance-method/acc-set/ObjC | setFoo: | c:objc(cs)I6(im)setFoo: | -[I6 setFoo:] | Def,Impl,RelChild | rel: 1 +// CHECK-NEXT: RelChild | I6 | c:objc(cs)I6 +// CHECK: [[@LINE-8]]:13 | field/ObjC | foo | c:objc(cs)I6@foo | <no-cgname> | Def,Impl,RelChild | rel: 1 + +-(void)method { + foo = 0; + // CHECK: [[@LINE-1]]:3 | field/ObjC | foo | c:objc(cs)I6@foo | <no-cgname> | Ref,Writ,RelCont | rel: 1 +} +@end + +@interface I7 +@property id foo; +@end + +@implementation I7 // implicit def of field _foo +// CHECK: [[@LINE-1]]:17 | instance-property/ObjC | foo | c:objc(cs)I7(py)foo | <no-cgname> | Def,Impl,RelChild,RelAcc | rel: 2 +// CHECK-NEXT: RelChild | I7 | c:objc(cs)I7 +// CHECK-NEXT: RelAcc | _foo | c:objc(cs)I7@_foo +// CHECK: [[@LINE-4]]:17 | instance-method/acc-get/ObjC | foo | c:objc(cs)I7(im)foo | -[I7 foo] | Def,Impl,RelChild | rel: 1 +// CHECK-NEXT: RelChild | I7 | c:objc(cs)I7 +// CHECK: [[@LINE-6]]:17 | instance-method/acc-set/ObjC | setFoo: | c:objc(cs)I7(im)setFoo: | -[I7 setFoo:] | Def,Impl,RelChild | rel: 1 +// CHECK-NEXT: RelChild | I7 | c:objc(cs)I7 +// CHECK: [[@LINE-8]]:17 | field/ObjC | _foo | c:objc(cs)I7@_foo | <no-cgname> | Def,Impl,RelChild | rel: 1 + +-(void)method { + _foo = 0; +// CHECK: [[@LINE-1]]:3 | field/ObjC | _foo | c:objc(cs)I7@_foo | <no-cgname> | Ref,Writ,RelCont | rel: 1 +} +@end + +#define NS_ENUM(_name, _type) enum _name:_type _name; enum _name : _type + +typedef NS_ENUM(AnotherEnum, int) { +// CHECK-NOT: [[@LINE-1]]:17 | type-alias/C | AnotherEnum | +// CHECK: [[@LINE-2]]:17 | enum/C | AnotherEnum | [[AnotherEnum_USR:.*]] | {{.*}} | Ref,RelCont | rel: 1 + AnotherEnumFirst = 0, + AnotherEnumSecond = 1, + AnotherEnumThird = 2, +}; + +AnotherEnum anotherT; +// CHECK: [[@LINE-1]]:1 | enum/C | AnotherEnum | [[AnotherEnum_USR]] | {{.*}} | Ref,RelCont | rel: 1 +enum AnotherEnum anotherE; +// CHECK: [[@LINE-1]]:6 | enum/C | AnotherEnum | [[AnotherEnum_USR]] | {{.*}} | Ref,RelCont | rel: 1 + +#define TRANSPARENT(_name) struct _name _name; struct _name +#define OPAQUE(_name) struct _name *_name; struct _name + +typedef TRANSPARENT(AStruct) { + int x; +}; + +AStruct aStructT; +// CHECK: [[@LINE-1]]:1 | struct/C | AStruct | {{.*}} | {{.*}} | Ref,RelCont | rel: 1 +struct AStruct aStructS; +// CHECK: [[@LINE-1]]:8 | struct/C | AStruct | {{.*}} | {{.*}} | Ref,RelCont | rel: 1 + +typedef OPAQUE(Separate) { + int x; +}; + +Separate separateT; +// CHECK: [[@LINE-1]]:1 | type-alias/C | Separate | {{.*}} | {{.*}} | Ref,RelCont | rel: 1 +struct Separate separateE; +// CHECK: [[@LINE-1]]:8 | struct/C | Separate | {{.*}} | {{.*}} | Ref,RelCont | rel: 1 diff --git a/test/Index/Core/index-subkinds.m b/test/Index/Core/index-subkinds.m index 15d60b1518964..5eea046721b6c 100644 --- a/test/Index/Core/index-subkinds.m +++ b/test/Index/Core/index-subkinds.m @@ -28,11 +28,11 @@ // CHECK: [[@LINE+3]]:12 | class(test)/ObjC | MyTestCase | c:objc(cs)MyTestCase | _OBJC_CLASS_$_MyTestCase | Ref,RelExt,RelCont | rel: 1 // CHECK-NEXT: RelExt,RelCont | cat | c:objc(cy)MyTestCase@cat -// CHECK: [[@LINE+1]]:23 | extension/ObjC | cat | c:objc(cy)MyTestCase@cat | <no-cgname> | Decl | rel: 0 +// CHECK: [[@LINE+1]]:23 | extension(test)/ObjC | cat | c:objc(cy)MyTestCase@cat | <no-cgname> | Decl | rel: 0 @interface MyTestCase(cat) @end // CHECK: [[@LINE+2]]:17 | class(test)/ObjC | MyTestCase | c:objc(cs)MyTestCase | _OBJC_CLASS_$_MyTestCase | Ref,RelCont | rel: 1 -// CHECK: [[@LINE+1]]:28 | extension/ObjC | MyTestCase | c:objc(cy)MyTestCase@cat | <no-cgname> | Def | rel: 0 +// CHECK: [[@LINE+1]]:28 | extension(test)/ObjC | cat | c:objc(cy)MyTestCase@cat | <no-cgname> | Def | rel: 0 @implementation MyTestCase(cat) // CHECK: [[@LINE+1]]:9 | instance-method(test)/ObjC | testInCat | c:objc(cs)MyTestCase(im)testInCat | -[MyTestCase(cat) testInCat] | Def,Dyn,RelChild | rel: 1 - (void)testInCat {} @@ -42,7 +42,7 @@ @class NSButton; @interface IBCls -// CHECK: [[@LINE+2]]:34 | instance-method/acc-get/ObjC | prop | c:objc(cs)IBCls(im)prop | -[IBCls prop] | Decl,Dyn,RelChild,RelAcc | rel: 2 +// CHECK: [[@LINE+2]]:34 | instance-method/acc-get/ObjC | prop | c:objc(cs)IBCls(im)prop | -[IBCls prop] | Decl,Dyn,Impl,RelChild,RelAcc | rel: 2 // CHECK: [[@LINE+1]]:34 | instance-property(IB)/ObjC | prop | c:objc(cs)IBCls(py)prop | <no-cgname> | Decl,RelChild | rel: 1 @property (readonly) IBOutlet id prop; // CHECK: [[@LINE+1]]:54 | instance-property(IB,IBColl)/ObjC | propColl | c:objc(cs)IBCls(py)propColl | <no-cgname> | Decl,RelChild | rel: 1 diff --git a/test/Index/Core/index-system.mm b/test/Index/Core/index-system.mm new file mode 100644 index 0000000000000..2ad31fae714f4 --- /dev/null +++ b/test/Index/Core/index-system.mm @@ -0,0 +1,3 @@ +// RUN: c-index-test core -print-source-symbols -- %s -isystem %S/Inputs/sys | FileCheck %S/Inputs/sys/system-head.h + +#include "system-head.h" diff --git a/test/Index/Core/index-with-module.m b/test/Index/Core/index-with-module.m index e50b247e8d570..c83de63701e10 100644 --- a/test/Index/Core/index-with-module.m +++ b/test/Index/Core/index-with-module.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t.mcp -// RUN: c-index-test core -print-source-symbols -- %s -I %S/Inputs/module -fmodules -fmodules-cache-path=%t.mcp | FileCheck %s +// RUN: c-index-test core -print-source-symbols -dump-imported-module-files -- %s -I %S/Inputs/module -fmodules -fmodules-cache-path=%t.mcp | FileCheck %s // CHECK: [[@LINE+1]]:9 | module/C | ModA | Decl | @import ModA; @@ -10,3 +10,9 @@ void foo() { // CHECK: [[@LINE+1]]:3 | function/C | ModA_func | c:@F@ModA_func | {{.*}} | Ref,Call,RelCall,RelCont | rel: 1 ModA_func(); } + +// CHECK: ==== Module ModA ==== +// CHECK: 2:6 | function/C | ModA_func | c:@F@ModA_func | {{.*}} | Decl | rel: 0 +// CHECK: ---- Module Inputs ---- +// CHECK: user | {{.*}}ModA.h +// CHECK: user | {{.*}}module.modulemap diff --git a/test/Index/annotate-nested-name-specifier.cpp b/test/Index/annotate-nested-name-specifier.cpp index eddd215a6779f..a7338db6b05b7 100644 --- a/test/Index/annotate-nested-name-specifier.cpp +++ b/test/Index/annotate-nested-name-specifier.cpp @@ -211,7 +211,7 @@ struct X9 : X8 { // CHECK: Punctuation: "::" [40:30 - 40:32] UsingDeclaration=iterator:40:46 // CHECK: Identifier: "vector" [40:32 - 40:38] TemplateRef=vector:4:12 // CHECK: Punctuation: "<" [40:38 - 40:39] UsingDeclaration=iterator:40:46 -// CHECK: Identifier: "type" [40:39 - 40:43] TypeRef=type:39:13 +// CHECK: Identifier: "type" [40:39 - 40:43] TypeRef=X2::type:39:13 // CHECK: Punctuation: ">" [40:43 - 40:44] UsingDeclaration=iterator:40:46 // CHECK: Punctuation: "::" [40:44 - 40:46] UsingDeclaration=iterator:40:46 // CHECK: Identifier: "iterator" [40:46 - 40:54] UsingDeclaration=iterator:40:46 @@ -223,7 +223,7 @@ struct X9 : X8 { // CHECK: Punctuation: "::" [41:21 - 41:23] UsingDeclaration=push_back:41:37 // CHECK: Identifier: "vector" [41:23 - 41:29] TemplateRef=vector:4:12 // CHECK: Punctuation: "<" [41:29 - 41:30] UsingDeclaration=push_back:41:37 -// CHECK: Identifier: "type" [41:30 - 41:34] TypeRef=type:39:13 +// CHECK: Identifier: "type" [41:30 - 41:34] TypeRef=X2::type:39:13 // CHECK: Punctuation: ">" [41:34 - 41:35] UsingDeclaration=push_back:41:37 // CHECK: Punctuation: "::" [41:35 - 41:37] UsingDeclaration=push_back:41:37 // CHECK: Identifier: "push_back" [41:37 - 41:46] UsingDeclaration=push_back:41:37 @@ -266,7 +266,7 @@ struct X9 : X8 { // CHECK: Identifier: "vector" [57:51 - 57:57] TemplateRef=vector:4:12 // CHECK: Punctuation: "<" [57:57 - 57:58] MemberRefExpr= // CHECK: Identifier: "T" [57:58 - 57:59] TypeRef=T:54:19 -// CHECK: Punctuation: ">" [57:59 - 57:60] CallExpr= +// CHECK: Punctuation: ">" [57:59 - 57:60] MemberRefExpr= // CHECK: Punctuation: "(" [57:60 - 57:61] CallExpr= // CHECK: Punctuation: ")" [57:61 - 57:62] CallExpr= @@ -283,7 +283,7 @@ struct X9 : X8 { // CHECK: Punctuation: "::" [76:5 - 76:7] MemberRefExpr=[71:8, 72:8] // CHECK: Identifier: "X4" [76:7 - 76:9] TemplateRef=X4:69:8 // CHECK: Punctuation: "<" [76:9 - 76:10] MemberRefExpr=[71:8, 72:8] -// CHECK: Identifier: "type" [76:10 - 76:14] TypeRef=type:70:13 +// CHECK: Identifier: "type" [76:10 - 76:14] TypeRef=X4::type:70:13 // CHECK: Punctuation: ">" [76:14 - 76:15] MemberRefExpr=[71:8, 72:8] // CHECK: Punctuation: "::" [76:15 - 76:17] MemberRefExpr=[71:8, 72:8] // CHECK: Identifier: "g" [76:17 - 76:18] OverloadedDeclRef=g[71:8, 72:8] @@ -296,7 +296,7 @@ struct X9 : X8 { // CHECK: Punctuation: "::" [77:11 - 77:13] MemberRefExpr= // CHECK: Identifier: "X4" [77:13 - 77:15] TemplateRef=X4:69:8 // CHECK: Punctuation: "<" [77:15 - 77:16] MemberRefExpr= -// CHECK: Identifier: "type" [77:16 - 77:20] TypeRef=type:70:13 +// CHECK: Identifier: "type" [77:16 - 77:20] TypeRef=X4::type:70:13 // CHECK: Punctuation: ">" [77:20 - 77:21] MemberRefExpr= // CHECK: Punctuation: "::" [77:21 - 77:23] MemberRefExpr= // CHECK: Identifier: "g" [77:23 - 77:24] MemberRefExpr= @@ -318,7 +318,7 @@ struct X9 : X8 { // CHECK: Punctuation: "::" [91:5 - 91:7] MemberRefExpr=g:86:8 // CHECK: Identifier: "X4" [91:7 - 91:9] TemplateRef=X4:69:8 // CHECK: Punctuation: "<" [91:9 - 91:10] MemberRefExpr=g:86:8 -// CHECK: Identifier: "type" [91:10 - 91:14] TypeRef=type:84:19 +// CHECK: Identifier: "type" [91:10 - 91:14] TypeRef=X4<int>::type:84:19 // CHECK: Punctuation: ">" [91:14 - 91:15] MemberRefExpr=g:86:8 // CHECK: Punctuation: "::" [91:15 - 91:17] MemberRefExpr=g:86:8 // CHECK: Identifier: "g" [91:17 - 91:18] MemberRefExpr=g:86:8 @@ -331,7 +331,7 @@ struct X9 : X8 { // CHECK: Punctuation: "::" [92:11 - 92:13] MemberRefExpr=g:86:8 // CHECK: Identifier: "X4" [92:13 - 92:15] TemplateRef=X4:69:8 // CHECK: Punctuation: "<" [92:15 - 92:16] MemberRefExpr=g:86:8 -// CHECK: Identifier: "type" [92:16 - 92:20] TypeRef=type:84:19 +// CHECK: Identifier: "type" [92:16 - 92:20] TypeRef=X4<int>::type:84:19 // CHECK: Punctuation: ">" [92:20 - 92:21] MemberRefExpr=g:86:8 // CHECK: Punctuation: "::" [92:21 - 92:23] MemberRefExpr=g:86:8 // CHECK: Identifier: "g" [92:23 - 92:24] MemberRefExpr=g:86:8 @@ -348,7 +348,7 @@ struct X9 : X8 { // CHECK: Punctuation: "::" [100:38 - 100:40] TypedefDecl=iter_type:100:63 (Definition) // CHECK: Identifier: "vector" [100:40 - 100:46] TemplateRef=vector:4:12 // CHECK: Punctuation: "<" [100:46 - 100:47] TypedefDecl=iter_type:100:63 (Definition) -// CHECK: Identifier: "type" [100:47 - 100:51] TypeRef=type:99:13 +// CHECK: Identifier: "type" [100:47 - 100:51] TypeRef=X5::type:99:13 // CHECK: Punctuation: ">" [100:51 - 100:52] TypedefDecl=iter_type:100:63 (Definition) // CHECK: Punctuation: "::" [100:52 - 100:54] TypedefDecl=iter_type:100:63 (Definition) // CHECK: Identifier: "iterator" [100:54 - 100:62] TypedefDecl=iter_type:100:63 (Definition) @@ -365,7 +365,7 @@ struct X9 : X8 { // CHECK: Keyword: "int" [101:47 - 101:50] TypedefDecl=int_ptr_type:101:62 (Definition) // CHECK: Punctuation: ">" [101:50 - 101:51] TypedefDecl=int_ptr_type:101:62 (Definition) // CHECK: Punctuation: "::" [101:51 - 101:53] TypedefDecl=int_ptr_type:101:62 (Definition) -// CHECK: Identifier: "iterator" [101:53 - 101:61] TypeRef=iterator:5:18 +// CHECK: Identifier: "iterator" [101:53 - 101:61] TypeRef=outer::inner::vector<int>::iterator:5:18 // CHECK: Identifier: "int_ptr_type" [101:62 - 101:74] TypedefDecl=int_ptr_type:101:62 (Definition) // Dependent template specialization types @@ -376,13 +376,13 @@ struct X9 : X8 { // CHECK: Punctuation: "::" [107:38 - 107:40] TypedefDecl=type1:107:76 (Definition) // CHECK: Identifier: "vector" [107:40 - 107:46] TemplateRef=vector:4:12 // CHECK: Punctuation: "<" [107:46 - 107:47] TypedefDecl=type1:107:76 (Definition) -// CHECK: Identifier: "type" [107:47 - 107:51] TypeRef=type:106:14 +// CHECK: Identifier: "type" [107:47 - 107:51] TypeRef=X6::type:106:14 // CHECK: Punctuation: ">" [107:51 - 107:52] TypedefDecl=type1:107:76 (Definition) // CHECK: Punctuation: "::" [107:52 - 107:54] TypedefDecl=type1:107:76 (Definition) // CHECK: Keyword: "template" [107:54 - 107:62] TypedefDecl=type1:107:76 (Definition) // CHECK: Identifier: "rebind" [107:63 - 107:69] TypedefDecl=type1:107:76 (Definition) // CHECK: Punctuation: "<" [107:69 - 107:70] TypedefDecl=type1:107:76 (Definition) -// CHECK: Identifier: "type" [107:70 - 107:74] TypeRef=type:106:14 +// CHECK: Identifier: "type" [107:70 - 107:74] TypeRef=X6::type:106:14 // CHECK: Punctuation: ">" [107:74 - 107:75] TypedefDecl=type1:107:76 (Definition) // CHECK: Identifier: "type1" [107:76 - 107:81] TypedefDecl=type1:107:76 (Definition) @@ -394,13 +394,13 @@ struct X9 : X8 { // CHECK: Punctuation: "::" [108:38 - 108:40] TypedefDecl=type2:108:83 (Definition) // CHECK: Identifier: "vector" [108:40 - 108:46] TemplateRef=vector:4:12 // CHECK: Punctuation: "<" [108:46 - 108:47] TypedefDecl=type2:108:83 (Definition) -// CHECK: Identifier: "type" [108:47 - 108:51] TypeRef=type:106:14 +// CHECK: Identifier: "type" [108:47 - 108:51] TypeRef=X6::type:106:14 // CHECK: Punctuation: ">" [108:51 - 108:52] TypedefDecl=type2:108:83 (Definition) // CHECK: Punctuation: "::" [108:52 - 108:54] TypedefDecl=type2:108:83 (Definition) // CHECK: Keyword: "template" [108:54 - 108:62] TypedefDecl=type2:108:83 (Definition) // CHECK: Identifier: "rebind" [108:63 - 108:69] TypedefDecl=type2:108:83 (Definition) // CHECK: Punctuation: "<" [108:69 - 108:70] TypedefDecl=type2:108:83 (Definition) -// CHECK: Identifier: "type" [108:70 - 108:74] TypeRef=type:106:14 +// CHECK: Identifier: "type" [108:70 - 108:74] TypeRef=X6::type:106:14 // CHECK: Punctuation: ">" [108:74 - 108:75] TypedefDecl=type2:108:83 (Definition) // CHECK: Punctuation: "::" [108:75 - 108:77] TypedefDecl=type2:108:83 (Definition) // CHECK: Identifier: "other" [108:77 - 108:82] TypedefDecl=type2:108:83 (Definition) @@ -414,13 +414,13 @@ struct X9 : X8 { // CHECK: Punctuation: "::" [109:35 - 109:37] TypedefDecl=type3:109:73 (Definition) // CHECK: Identifier: "vector" [109:37 - 109:43] TemplateRef=vector:4:12 // CHECK: Punctuation: "<" [109:43 - 109:44] TypedefDecl=type3:109:73 (Definition) -// CHECK: Identifier: "type" [109:44 - 109:48] TypeRef=type:106:14 +// CHECK: Identifier: "type" [109:44 - 109:48] TypeRef=X6::type:106:14 // CHECK: Punctuation: ">" [109:48 - 109:49] TypedefDecl=type3:109:73 (Definition) // CHECK: Punctuation: "::" [109:49 - 109:51] TypedefDecl=type3:109:73 (Definition) // CHECK: Keyword: "template" [109:51 - 109:59] TypedefDecl=type3:109:73 (Definition) // CHECK: Identifier: "rebind" [109:60 - 109:66] TypedefDecl=type3:109:73 (Definition) // CHECK: Punctuation: "<" [109:66 - 109:67] TypedefDecl=type3:109:73 (Definition) -// CHECK: Identifier: "type" [109:67 - 109:71] TypeRef=type:106:14 +// CHECK: Identifier: "type" [109:67 - 109:71] TypeRef=X6::type:106:14 // CHECK: Punctuation: ">" [109:71 - 109:72] TypedefDecl=type3:109:73 (Definition) // CHECK: Identifier: "type3" [109:73 - 109:78] TypedefDecl=type3:109:73 (Definition) @@ -431,13 +431,13 @@ struct X9 : X8 { // CHECK: Punctuation: "::" [110:35 - 110:37] TypedefDecl=type4:110:80 (Definition) // CHECK: Identifier: "vector" [110:37 - 110:43] TemplateRef=vector:4:12 // CHECK: Punctuation: "<" [110:43 - 110:44] TypedefDecl=type4:110:80 (Definition) -// CHECK: Identifier: "type" [110:44 - 110:48] TypeRef=type:106:14 +// CHECK: Identifier: "type" [110:44 - 110:48] TypeRef=X6::type:106:14 // CHECK: Punctuation: ">" [110:48 - 110:49] TypedefDecl=type4:110:80 (Definition) // CHECK: Punctuation: "::" [110:49 - 110:51] TypedefDecl=type4:110:80 (Definition) // CHECK: Keyword: "template" [110:51 - 110:59] TypedefDecl=type4:110:80 (Definition) // CHECK: Identifier: "rebind" [110:60 - 110:66] TypedefDecl=type4:110:80 (Definition) // CHECK: Punctuation: "<" [110:66 - 110:67] TypedefDecl=type4:110:80 (Definition) -// CHECK: Identifier: "type" [110:67 - 110:71] TypeRef=type:106:14 +// CHECK: Identifier: "type" [110:67 - 110:71] TypeRef=X6::type:106:14 // CHECK: Punctuation: ">" [110:71 - 110:72] TypedefDecl=type4:110:80 (Definition) // CHECK: Punctuation: "::" [110:72 - 110:74] TypedefDecl=type4:110:80 (Definition) // CHECK: Identifier: "other" [110:74 - 110:79] TypedefDecl=type4:110:80 (Definition) @@ -451,9 +451,9 @@ struct X9 : X8 { // CHECK: Punctuation: "::" [126:29 - 126:31] TypedefDecl=type:126:74 (Definition) // CHECK: Identifier: "apply_meta" [126:31 - 126:41] TemplateRef=apply_meta:116:12 // CHECK: Punctuation: "<" [126:41 - 126:42] TypedefDecl=type:126:74 (Definition) -// CHECK: Identifier: "T_type" [126:42 - 126:48] TypeRef=T_type:124:13 +// CHECK: Identifier: "T_type" [126:42 - 126:48] TypeRef=X7::T_type:124:13 // CHECK: Punctuation: "," [126:48 - 126:49] TypedefDecl=type:126:74 (Definition) -// CHECK: Identifier: "U_type" [126:50 - 126:56] TypeRef=U_type:125:13 +// CHECK: Identifier: "U_type" [126:50 - 126:56] TypeRef=X7::U_type:125:13 // CHECK: Punctuation: "::" [126:56 - 126:58] TypedefDecl=type:126:74 (Definition) // CHECK: Keyword: "template" [126:58 - 126:66] TypedefDecl=type:126:74 (Definition) // CHECK: Identifier: "apply" [126:67 - 126:72] TypedefDecl=type:126:74 (Definition) @@ -461,6 +461,6 @@ struct X9 : X8 { // CHECK: Identifier: "type" [126:74 - 126:78] TypedefDecl=type:126:74 (Definition) // Member access expressions -// CHECK: Identifier: "inherited" [136:5 - 136:14] TypeRef=inherited:134:14 +// CHECK: Identifier: "inherited" [136:5 - 136:14] TypeRef=X9::inherited:134:14 // CHECK: Punctuation: "::" [136:14 - 136:16] MemberRefExpr=f:130:8 // CHECK: Identifier: "f" [136:16 - 136:17] MemberRefExpr=f:130:8 diff --git a/test/Index/comment-cplus-decls.cpp b/test/Index/comment-cplus-decls.cpp index d4f968f5fbf03..6e32c60a22286 100644 --- a/test/Index/comment-cplus-decls.cpp +++ b/test/Index/comment-cplus-decls.cpp @@ -2,9 +2,15 @@ // RUN: mkdir %t // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 %s > %t/out // RUN: FileCheck %s < %t/out +// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 -std=c++98 %s > %t/98 +// RUN: FileCheck %s < %t/98 +// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 -std=c++11 %s > %t/11 +// RUN: FileCheck %s < %t/11 // Ensure that XML we generate is not invalid. // RUN: FileCheck %s -check-prefix=WRONG < %t/out +// RUN: FileCheck %s -check-prefix=WRONG < %t/98 +// RUN: FileCheck %s -check-prefix=WRONG < %t/11 // WRONG-NOT: CommentXMLInvalid // rdar://12378714 @@ -42,7 +48,7 @@ protected: // CHECK: <Declaration>class Test {}</Declaration> // CHECK: <Declaration>Test() : reserved(new Test::data()) {}</Declaration> // CHECK: <Declaration>unsigned int getID() const</Declaration> -// CHECK: <Declaration>~Test()</Declaration> +// CHECK: <Declaration>~Test(){{( noexcept)?}}</Declaration> // CHECK: <Declaration>Test::data *reserved</Declaration> @@ -96,7 +102,7 @@ namespace test0 { friend void ns::f(int a); }; } -// CHECK: <Declaration>friend void f(int a)</Declaration> +// CHECK: <Declaration>friend void ns::f(int a)</Declaration> namespace test1 { template <class T> struct Outer { @@ -109,7 +115,7 @@ namespace test1 { }; }; } -// CHECK: <Declaration>friend void foo(T)</Declaration> +// CHECK: <Declaration>friend void Outer<T>::foo(T)</Declaration> namespace test2 { namespace foo { @@ -123,7 +129,7 @@ namespace test2 { friend void ::test2::foo::Func(int x); }; } -// CHECK: <Declaration>friend void Func(int x)</Declaration> +// CHECK: <Declaration>friend void ::test2::foo::Func(int x)</Declaration> namespace test3 { template<class T> class vector { @@ -143,7 +149,7 @@ namespace test3 { }; } // CHECK: <Declaration>void f(const T &t = T())</Declaration> -// CHECK: <Declaration>friend void f(const test3::A &)</Declaration> +// CHECK: <Declaration>friend void vector<A>::f(const test3::A &)</Declaration> class MyClass { diff --git a/test/Index/complete-block-properties.m b/test/Index/complete-block-properties.m index 4697703c8e5c3..a754712e4c998 100644 --- a/test/Index/complete-block-properties.m +++ b/test/Index/complete-block-properties.m @@ -68,8 +68,8 @@ void noQualifierParens(NoQualifierParens *f) { // RUN: c-index-test -code-completion-at=%s:65:6 %s | FileCheck -check-prefix=CHECK-CC2 %s //CHECK-CC2: ObjCInstanceMethodDecl:{ResultType void (^)(void)}{TypedText blockProperty} (35) //CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{ResultType BarBlock}{TypedText blockProperty2} (35) -//CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText setBlockProperty2:}{Placeholder BarBlock blockProperty2} (35) -//CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText setBlockProperty:}{Placeholder void (^)(void)blockProperty} (35) +//CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText setBlockProperty2:}{Placeholder ^int(int *)blockProperty2} (35) +//CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText setBlockProperty:}{Placeholder ^(void)blockProperty} (35) @interface ClassProperties @@ -86,3 +86,9 @@ void classBlockProperties() { //CHECK-CC3: ObjCPropertyDecl:{ResultType void}{TypedText explicit}{LeftParen (}{RightParen )} (35) //CHECK-CC3-NEXT: ObjCPropertyDecl:{ResultType void (^)()}{TypedText explicit}{Equal = }{Placeholder ^(void)} (38) //CHECK-CC3-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText explicitReadonly}{LeftParen (}{RightParen )} (35) + +void implicitSetterBlockPlaceholder(Test* test) { + [test setBlock: ^{}]; +} +// RUN: c-index-test -code-completion-at=%s:91:9 %s | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType void}{TypedText setBlocker:}{Placeholder ^Foo(int x, Foo y, FooBlock foo)blocker} (37) diff --git a/test/Index/complete-cached-globals.cpp b/test/Index/complete-cached-globals.cpp new file mode 100644 index 0000000000000..791faf2be1289 --- /dev/null +++ b/test/Index/complete-cached-globals.cpp @@ -0,0 +1,25 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +namespace SomeNamespace { + class SomeClass { + }; + void SomeFunction(); +} + +using SomeNamespace::SomeClass; +using SomeNamespace::SomeFunction; + +static void foo() { + return; +} + +// rdar://23454249 + +// RUN: c-index-test -code-completion-at=%s:14:3 %s | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:3 %s | FileCheck -check-prefix=CHECK-CC1 %s + +// CHECK-CC1: ClassDecl:{TypedText SomeClass} (50) +// CHECK-CC1: FunctionDecl:{ResultType void}{TypedText SomeFunction}{LeftParen (}{RightParen )} (50) +// CHECK-CC1-NOT: {Text SomeNamespace::}{TypedText SomeClass} +// CHECK-CC1-NOT: {Text SomeNamespace::}{TypedText SomeFunction} diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m index e3fce6bc20f88..c2b0670077a67 100644 --- a/test/Index/complete-objc-message.m +++ b/test/Index/complete-objc-message.m @@ -346,3 +346,54 @@ void test_Nullability(Nullability *n, A* a) { // RUN: c-index-test -code-completion-at=%s:197:6 %s | FileCheck -check-prefix=CHECK-NULLABLE %s // CHECK-NULLABLE: ObjCInstanceMethodDecl:{ResultType A * _Nonnull}{TypedText method:}{Placeholder (nullable A *)} + +// rdar://28012953 +// Code completion results should include instance methods from RootProtocol and +// RootClass when completing a method invocation for a RootClass object because +// RootClasses metaclass subclasses from RootClass (i.e. RootClass is actually +// an instance of RootClass). + +@protocol SubRootProtocol + +- (void)subProtocolInstanceMethod; + +@end + +@protocol RootProtocol <SubRootProtocol> + +- (void)protocolInstanceMethod; ++ (void)protocolClassMethod; + +@end + +@interface RootClass <RootProtocol> + +- (void)instanceMethod; ++ (void)classMethod; + +@end + +@protocol RootCategoryProtocol + +- (void)categoryProtocolInstanceMethod; + +@end + +@interface RootClass (Cat) <RootCategoryProtocol> + +- (void)categoryInstanceMethod; + +@end + +void completeAllTheRootThings() { + [RootClass classMethod]; +} + +// RUN: c-index-test -code-completion-at=%s:389:14 %s | FileCheck -check-prefix=CHECK-ROOT %s +// CHECK-ROOT: ObjCInstanceMethodDecl:{ResultType void}{TypedText categoryInstanceMethod} (35) +// CHECK-ROOT-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText categoryProtocolInstanceMethod} (37) +// CHECK-ROOT-NEXT: ObjCClassMethodDecl:{ResultType void}{TypedText classMethod} (35) +// CHECK-ROOT-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText instanceMethod} (35) +// CHECK-ROOT-NEXT: ObjCClassMethodDecl:{ResultType void}{TypedText protocolClassMethod} (37) +// CHECK-ROOT-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText protocolInstanceMethod} (37) +// CHECK-ROOT-NEXT: ObjCInstanceMethodDecl:{ResultType void}{TypedText subProtocolInstanceMethod} (37) diff --git a/test/Index/complete-preamble.h b/test/Index/complete-preamble.h index e696284c09643..1972c2acb5681 100644 --- a/test/Index/complete-preamble.h +++ b/test/Index/complete-preamble.h @@ -1,6 +1,11 @@ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Weverything" + namespace std { void wibble(); } +#pragma clang diagnostic pop + namespace std { } diff --git a/test/Index/crash-recovery-code-complete.c b/test/Index/crash-recovery-code-complete.c index b2a1a9b3f96b2..dfb47316dc9d7 100644 --- a/test/Index/crash-recovery-code-complete.c +++ b/test/Index/crash-recovery-code-complete.c @@ -10,5 +10,6 @@ // FIXME: Please investigate abnormal path in MemoryBuffer. // REQUIRES: can-remove-opened-file +// UNSUPPORTED: libstdcxx-safe-mode #warning parsing original file diff --git a/test/Index/crash-recovery-modules.m b/test/Index/crash-recovery-modules.m index 3e7e8059aaaad..296416df97f28 100644 --- a/test/Index/crash-recovery-modules.m +++ b/test/Index/crash-recovery-modules.m @@ -4,7 +4,7 @@ // 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 -fmodules-cache-path=%t -Xclang -fdisable-module-hash -I %S/Inputs/Headers -DCRASH %s > /dev/null 2> %t.err // RUN: FileCheck < %t.err -check-prefix=CHECK-CRASH %s -// CHECK-CRASH: crash-recovery-modules.m:16:9:{16:2-16:14}: fatal error: could not build module 'Crash' +// CHECK-CRASH: crash-recovery-modules.m:17:9:{17:2-17:14}: fatal error: could not build module 'Crash' // Parse the file again, without crashing, to make sure that // subsequent parses do the right thing. @@ -12,6 +12,7 @@ // REQUIRES: crash-recovery // REQUIRES: shell +// UNSUPPORTED: libstdcxx-safe-mode @import Crash; diff --git a/test/Index/crash-recovery-reparse.c b/test/Index/crash-recovery-reparse.c index baa6604b53520..2e4b51a8ca4b2 100644 --- a/test/Index/crash-recovery-reparse.c +++ b/test/Index/crash-recovery-reparse.c @@ -7,5 +7,6 @@ // CHECK-REPARSE-SOURCE-CRASH: Unable to reparse translation unit // // REQUIRES: crash-recovery +// UNSUPPORTED: libstdcxx-safe-mode #warning parsing original file diff --git a/test/Index/crash-recovery.c b/test/Index/crash-recovery.c index e8e84bc504dc1..bf13c69eb1279 100644 --- a/test/Index/crash-recovery.c +++ b/test/Index/crash-recovery.c @@ -4,5 +4,6 @@ // RUN: env LIBCLANG_DISABLE_CRASH_RECOVERY=1 not --crash c-index-test -test-load-source all %s // // REQUIRES: crash-recovery +// UNSUPPORTED: libstdcxx-safe-mode #pragma clang __debug crash diff --git a/test/Index/file-refs.cpp b/test/Index/file-refs.cpp index c5a728b434e61..a645527048840 100644 --- a/test/Index/file-refs.cpp +++ b/test/Index/file-refs.cpp @@ -98,7 +98,7 @@ void f() { // RUN: -file-refs-at=%s:44:16 \ // CHECK-NEXT: CallExpr=S:35:3 // CHECK-NEXT: TypedefDecl=Cake:39:11 (Definition) =[39:11 - 39:15] -// CHECK-NEXT: TypeRef=Cake:39:11 =[42:3 - 42:7] -// CHECK-NEXT: TypeRef=Cake:39:11 =[44:14 - 44:18] +// CHECK-NEXT: TypeRef=Test2::Cake:39:11 =[42:3 - 42:7] +// CHECK-NEXT: TypeRef=Test2::Cake:39:11 =[44:14 - 44:18] // RUN: %s | FileCheck %s diff --git a/test/Index/get-cursor.m b/test/Index/get-cursor.m index d321233401c8e..af277d45fdf42 100644 --- a/test/Index/get-cursor.m +++ b/test/Index/get-cursor.m @@ -129,6 +129,31 @@ void foo3(Test3 *test3) { } @end +#define NS_ENUM(_name, _type) enum _name : _type _name; enum _name : _type +typedef NS_ENUM(TestTransparent, int) { + TestTransparentFirst = 0, + TestTransparentSecond = 1, +}; +typedef enum TestTransparent NotTransparent; + +TestTransparent transparentTypedef; +enum TestTransparent transparentUnderlying; +NotTransparent opaqueTypedef; + +#define MY_ENUM(_name, _type) enum _name : _type _name##_t; enum _name : _type +typedef MY_ENUM(TokenPaste, int) { + TokenPasteFirst = 0, +}; +TokenPaste_t opaqueTypedef2; + +#define MY_TYPE(_name) struct _name _name; struct _name +typedef MY_TYPE(SomeT) { int x; }; +SomeT someVar; + +#define MY_TYPE2(_name) struct _name *_name; struct _name +typedef MY_TYPE2(SomeT2) { int x; }; +SomeT2 someVar2; + // 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 @@ -193,3 +218,11 @@ void foo3(Test3 *test3) { // RUN: c-index-test -cursor-at=%s:127:8 %s | FileCheck -check-prefix=CHECK-RECEIVER-WITH-NULLABILITY %s // RUN: c-index-test -cursor-at=%s:128:8 %s | FileCheck -check-prefix=CHECK-RECEIVER-WITH-NULLABILITY %s // CHECK-RECEIVER-WITH-NULLABILITY: Receiver-type=ObjCId + +// RUN: c-index-test -cursor-at=%s:139:1 -cursor-at=%s:140:6 -cursor-at=%s:141:1 -cursor-at=%s:147:1 -cursor-at=%s:151:1 -cursor-at=%s:155:1 %s | FileCheck -check-prefix=CHECK-TRANSPARENT %s +// CHECK-TRANSPARENT: 139:1 TypeRef=TestTransparent:133:17 (Transparent: enum TestTransparent) Extent=[139:1 - 139:16] Spelling=TestTransparent ([139:1 - 139:16]) +// CHECK-TRANSPARENT: 140:6 TypeRef=enum TestTransparent:133:17 Extent=[140:6 - 140:21] Spelling=enum TestTransparent ([140:6 - 140:21]) +// CHECK-TRANSPARENT: 141:1 TypeRef=NotTransparent:137:30 Extent=[141:1 - 141:15] Spelling=NotTransparent ([141:1 - 141:15]) +// CHECK-TRANSPARENT: 147:1 TypeRef=TokenPaste_t:144:9 Extent=[147:1 - 147:13] Spelling=TokenPaste_t ([147:1 - 147:13]) +// CHECK-TRANSPARENT: 151:1 TypeRef=SomeT:150:17 (Transparent: struct SomeT) Extent=[151:1 - 151:6] Spelling=SomeT ([151:1 - 151:6]) +// CHECK-TRANSPARENT: 155:1 TypeRef=SomeT2:154:18 Extent=[155:1 - 155:7] Spelling=SomeT2 ([155:1 - 155:7]) diff --git a/test/Index/index-decls.m b/test/Index/index-decls.m index 7f7f11576ab8b..a5368ecb0c0da 100644 --- a/test/Index/index-decls.m +++ b/test/Index/index-decls.m @@ -64,9 +64,9 @@ int test1() { // 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] +// CHECK: [indexDeclaration]: kind: objc-ivar | name: _prop | {{.*}} | loc: 11:20 // CHECK: [indexDeclaration]: kind: objc-ivar | name: _auto_prop | {{.*}} | loc: 20:33 // CHECK: [indexEntityReference]: kind: objc-ivar | name: _auto_prop | {{.*}} | loc: 25:3 diff --git a/test/Index/opencl-types.cl b/test/Index/opencl-types.cl new file mode 100644 index 0000000000000..f15bc745a80fd --- /dev/null +++ b/test/Index/opencl-types.cl @@ -0,0 +1,24 @@ +// RUN: c-index-test -test-print-type %s | FileCheck %s + +#pragma OPENCL EXTENSION cl_khr_fp16 : enable +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +typedef half half4 __attribute__((ext_vector_type(4))); +typedef float float4 __attribute__((ext_vector_type(4))); +typedef double double4 __attribute__((ext_vector_type(4))); + +void kernel testFloatTypes() { + half scalarHalf; + half4 vectorHalf; + float scalarFloat; + float4 vectorFloat; + double scalarDouble; + double4 vectorDouble; +} + +// CHECK: VarDecl=scalarHalf:11:8 (Definition) [type=half] [typekind=Half] [isPOD=1] +// CHECK: VarDecl=vectorHalf:12:9 (Definition) [type=half4] [typekind=Typedef] [canonicaltype=half __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] +// CHECK: VarDecl=scalarFloat:13:9 (Definition) [type=float] [typekind=Float] [isPOD=1] +// CHECK: VarDecl=vectorFloat:14:10 (Definition) [type=float4] [typekind=Typedef] [canonicaltype=float __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] +// CHECK: VarDecl=scalarDouble:15:10 (Definition) [type=double] [typekind=Double] [isPOD=1] +// CHECK: VarDecl=vectorDouble:16:11 (Definition) [type=double4] [typekind=Typedef] [canonicaltype=double __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] diff --git a/test/Index/overriding-ftemplate-comments.cpp b/test/Index/overriding-ftemplate-comments.cpp index 7fc15f0b00bd8..855d2691d0a20 100644 --- a/test/Index/overriding-ftemplate-comments.cpp +++ b/test/Index/overriding-ftemplate-comments.cpp @@ -82,5 +82,5 @@ void comment_to_html_conversion_22(); template<class CCC1, template<class CCC2, template<class CCC3, class CCC4> class QQQ> class PPP> void comment_to_html_conversion_22(); -// CHECK: FullCommentAsXML=[<Function templateKind="template" file="{{[^"]+}}overriding-ftemplate-comments.cpp" line="[[@LINE-2]]" column="6"><Name>comment_to_html_conversion_22</Name><USR>c:@FT@>2#T#t>2#T#t>2#T#Tcomment_to_html_conversion_22#v#</USR><Declaration>template <class CCC1, template <class CCC2, template <class CCC3, class CCC4>\n class QQQ> class PPP>\nvoid comment_to_html_conversion_22()</Declaration><TemplateParameters><Parameter><Name>CCC1</Name><Index>0</Index><Discussion><Para> Ccc 1 </Para></Discussion></Parameter><Parameter><Name>PPP</Name><Index>1</Index><Discussion><Para> Zzz </Para></Discussion></Parameter><Parameter><Name>CCC2</Name><Discussion><Para> Ccc 2 </Para></Discussion></Parameter><Parameter><Name>CCC3</Name><Discussion><Para> Ccc 3 </Para></Discussion></Parameter><Parameter><Name>CCC4</Name><Discussion><Para> Ccc 4 </Para></Discussion></Parameter><Parameter><Name>QQQ</Name><Discussion><Para> Bbb</Para></Discussion></Parameter></TemplateParameters></Function>] +// CHECK: FullCommentAsXML=[<Function templateKind="template" file="{{[^"]+}}overriding-ftemplate-comments.cpp" line="[[@LINE-2]]" column="6"><Name>comment_to_html_conversion_22</Name><USR>c:@FT@>2#T#t>2#T#t>2#T#Tcomment_to_html_conversion_22#v#</USR><Declaration>template <class CCC1, template <class CCC2, template <class CCC3, class CCC4>\n class QQQ> class PPP>\nvoid comment_to_html_conversion_22()</Declaration><TemplateParameters><Parameter><Name>CCC1</Name><Index>0</Index><Discussion><Para> Ccc 1 </Para></Discussion></Parameter><Parameter><Name>PPP</Name><Index>1</Index><Discussion><Para> Zzz </Para></Discussion></Parameter><Parameter><Name>CCC2</Name><Discussion><Para> Ccc 2 </Para></Discussion></Parameter><Parameter><Name>CCC3</Name><Discussion><Para> Ccc 3 </Para></Discussion></Parameter><Parameter><Name>CCC4</Name><Discussion><Para> Ccc 4 </Para></Discussion></Parameter><Parameter><Name>QQQ</Name><Discussion><Para> Bbb</Para></Discussion></Parameter></TemplateParameters></Function>] diff --git a/test/Index/overriding-method-comments.mm b/test/Index/overriding-method-comments.mm index d995e0eca7823..824d055b16fb9 100644 --- a/test/Index/overriding-method-comments.mm +++ b/test/Index/overriding-method-comments.mm @@ -78,7 +78,7 @@ struct Base { void Base::foo_outofline(int RRR) {} -// CHECK: FullCommentAsXML=[<Function isInstanceMethod="1" file="{{[^"]+}}overriding-method-comments.mm" line="[[@LINE-2]]" column="12"><Name>foo_outofline</Name><USR>c:@S@Base@F@foo_outofline#I#</USR><Declaration>void foo_outofline(int RRR)</Declaration><Abstract><Para> Does something. </Para></Abstract><Parameters><Parameter><Name>RRR</Name><Index>0</Index><Direction isExplicit="0">in</Direction><Discussion><Para> argument to undefined virtual.</Para></Discussion></Parameter></Parameters></Function>] +// CHECK: FullCommentAsXML=[<Function isInstanceMethod="1" file="{{[^"]+}}overriding-method-comments.mm" line="[[@LINE-2]]" column="12"><Name>foo_outofline</Name><USR>c:@S@Base@F@foo_outofline#I#</USR><Declaration>void Base::foo_outofline(int RRR)</Declaration><Abstract><Para> Does something. </Para></Abstract><Parameters><Parameter><Name>RRR</Name><Index>0</Index><Direction isExplicit="0">in</Direction><Discussion><Para> argument to undefined virtual.</Para></Discussion></Parameter></Parameters></Function>] struct Derived : public Base { virtual void foo_pure(int PPP); diff --git a/test/Index/pch-from-libclang.c b/test/Index/pch-from-libclang.c new file mode 100644 index 0000000000000..349fcac01ecad --- /dev/null +++ b/test/Index/pch-from-libclang.c @@ -0,0 +1,27 @@ +// Check that clang can use a PCH created from libclang. + +// FIXME: Non-darwin bots fail. Would need investigation using -module-file-info to see what is the difference in modules generated from libclang vs the compiler invocation, in those systems. +// REQUIRES: system-darwin + +// RUN: %clang_cc1 -fsyntax-only %s -verify +// RUN: c-index-test -write-pch %t.h.pch %s -fmodules -fmodules-cache-path=%t.mcp -Xclang -triple -Xclang x86_64-apple-darwin +// RUN: %clang -fsyntax-only -include %t.h %s -Xclang -verify -fmodules -fmodules-cache-path=%t.mcp -Xclang -detailed-preprocessing-record -Xclang -triple -Xclang x86_64-apple-darwin -Xclang -fallow-pch-with-compiler-errors +// RUN: %clang -x c-header %s -o %t.clang.h.pch -fmodules -fmodules-cache-path=%t.mcp -Xclang -detailed-preprocessing-record -Xclang -triple -Xclang x86_64-apple-darwin -Xclang -fallow-pch-with-compiler-errors -Xclang -verify +// RUN: c-index-test -test-load-source local %s -include %t.clang.h -fmodules -fmodules-cache-path=%t.mcp -Xclang -triple -Xclang x86_64-apple-darwin | FileCheck %s + +#ifndef HEADER +#define HEADER + +void some_function(undeclared_type p); // expected-error{{unknown type name}} + +struct S { int x; }; + +#else +// expected-no-diagnostics + +void test(struct S *s) { + // CHECK: [[@LINE+1]]:6: MemberRefExpr=x:[[@LINE-6]]:16 + s->x = 0; +} + +#endif diff --git a/test/Index/print-type.cpp b/test/Index/print-type.cpp index 784733f421b43..108ba53c80b0b 100644 --- a/test/Index/print-type.cpp +++ b/test/Index/print-type.cpp @@ -17,6 +17,7 @@ struct Bar { Bar(outer::Foo<bool>* foo) { } typedef int FooType; + using AliasType = double; int *p; int *f(int *p, char *x, FooType z) { const FooType w = z; @@ -25,7 +26,7 @@ struct Bar { typedef double OtherType; typedef int ArrayType[5]; Baz<int, 1, Foo> baz; - Qux<int, char*, Foo<int>> qux; + Qux<int, char*, Foo<int>, FooType> qux; }; } @@ -87,91 +88,92 @@ auto autoTemplRefParam = templRefParam; // CHECK: NamespaceRef=outer:1:11 [type=] [typekind=Invalid] [isPOD=0] // CHECK: TemplateRef=Foo:4:8 [type=] [typekind=Invalid] [isPOD=0] // CHECK: CompoundStmt= [type=] [typekind=Invalid] [isPOD=0] -// CHECK: TypedefDecl=FooType:19:15 (Definition) [type=FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] -// CHECK: FieldDecl=p:20:8 (Definition) [type=int *] [typekind=Pointer] [isPOD=1] [pointeetype=int] [pointeekind=Int] -// CHECK: CXXMethod=f:21:8 (Definition) [type=int *(int *, char *, FooType){{.*}}] [typekind=FunctionProto] [canonicaltype=int *(int *, char *, int){{.*}}] [canonicaltypekind=FunctionProto] [resulttype=int *] [resulttypekind=Pointer] [args= [int *] [Pointer] [char *] [Pointer] [FooType] [Typedef]] [isPOD=0] -// CHECK: ParmDecl=p:21:15 (Definition) [type=int *] [typekind=Pointer] [isPOD=1] [pointeetype=int] [pointeekind=Int] -// CHECK: ParmDecl=x:21:24 (Definition) [type=char *] [typekind=Pointer] [isPOD=1] [pointeetype=char] [pointeekind=Char_{{[US]}}] -// CHECK: ParmDecl=z:21:35 (Definition) [type=FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] -// CHECK: TypeRef=FooType:19:15 [type=FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: TypedefDecl=FooType:19:15 (Definition) [type=outer::inner::Bar::FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: TypeAliasDecl=AliasType:20:9 (Definition) [type=outer::inner::Bar::AliasType] [typekind=Typedef] [canonicaltype=double] [canonicaltypekind=Double] [isPOD=1] +// CHECK: FieldDecl=p:21:8 (Definition) [type=int *] [typekind=Pointer] [isPOD=1] [pointeetype=int] [pointeekind=Int] +// CHECK: CXXMethod=f:22:8 (Definition) [type=int *(int *, char *, outer::inner::Bar::FooType){{.*}}] [typekind=FunctionProto] [canonicaltype=int *(int *, char *, int){{.*}}] [canonicaltypekind=FunctionProto] [resulttype=int *] [resulttypekind=Pointer] [args= [int *] [Pointer] [char *] [Pointer] [outer::inner::Bar::FooType] [Typedef]] [isPOD=0] +// CHECK: ParmDecl=p:22:15 (Definition) [type=int *] [typekind=Pointer] [isPOD=1] [pointeetype=int] [pointeekind=Int] +// CHECK: ParmDecl=x:22:24 (Definition) [type=char *] [typekind=Pointer] [isPOD=1] [pointeetype=char] [pointeekind=Char_{{[US]}}] +// CHECK: ParmDecl=z:22:35 (Definition) [type=outer::inner::Bar::FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: TypeRef=outer::inner::Bar::FooType:19:15 [type=outer::inner::Bar::FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] // CHECK: CompoundStmt= [type=] [typekind=Invalid] [isPOD=0] // CHECK: DeclStmt= [type=] [typekind=Invalid] [isPOD=0] -// CHECK: VarDecl=w:22:19 (Definition) [type=const FooType] [typekind=Typedef] const [canonicaltype=const int] [canonicaltypekind=Int] [isPOD=1] -// CHECK: TypeRef=FooType:19:15 [type=FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] -// CHECK: UnexposedExpr=z:21:35 [type=FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] -// CHECK: DeclRefExpr=z:21:35 [type=FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: VarDecl=w:23:19 (Definition) [type=const outer::inner::Bar::FooType] [typekind=Typedef] const [canonicaltype=const int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: TypeRef=outer::inner::Bar::FooType:19:15 [type=outer::inner::Bar::FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: UnexposedExpr=z:22:35 [type=outer::inner::Bar::FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: DeclRefExpr=z:22:35 [type=outer::inner::Bar::FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] // CHECK: ReturnStmt= [type=] [typekind=Invalid] [isPOD=0] // CHECK: BinaryOperator= [type=int *] [typekind=Pointer] [isPOD=1] [pointeetype=int] [pointeekind=Int] -// CHECK: UnexposedExpr=p:21:15 [type=int *] [typekind=Pointer] [isPOD=1] [pointeetype=int] [pointeekind=Int] -// CHECK: DeclRefExpr=p:21:15 [type=int *] [typekind=Pointer] [isPOD=1] [pointeetype=int] [pointeekind=Int] -// CHECK: UnexposedExpr=z:21:35 [type=FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] -// CHECK: DeclRefExpr=z:21:35 [type=FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] -// CHECK: TypedefDecl=OtherType:25:18 (Definition) [type=OtherType] [typekind=Typedef] [canonicaltype=double] [canonicaltypekind=Double] [isPOD=1] -// CHECK: TypedefDecl=ArrayType:26:15 (Definition) [type=ArrayType] [typekind=Typedef] [canonicaltype=int [5]] [canonicaltypekind=ConstantArray] [isPOD=1] +// CHECK: UnexposedExpr=p:22:15 [type=int *] [typekind=Pointer] [isPOD=1] [pointeetype=int] [pointeekind=Int] +// CHECK: DeclRefExpr=p:22:15 [type=int *] [typekind=Pointer] [isPOD=1] [pointeetype=int] [pointeekind=Int] +// CHECK: UnexposedExpr=z:22:35 [type=outer::inner::Bar::FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: DeclRefExpr=z:22:35 [type=outer::inner::Bar::FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: TypedefDecl=OtherType:26:18 (Definition) [type=outer::inner::Bar::OtherType] [typekind=Typedef] [canonicaltype=double] [canonicaltypekind=Double] [isPOD=1] +// CHECK: TypedefDecl=ArrayType:27:15 (Definition) [type=outer::inner::Bar::ArrayType] [typekind=Typedef] [canonicaltype=int [5]] [canonicaltypekind=ConstantArray] [isPOD=1] // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1] -// CHECK: FieldDecl=baz:27:20 (Definition) [type=Baz<int, 1, Foo>] [typekind=Unexposed] [templateargs/3= [type=int] [typekind=Int]] [canonicaltype=outer::Baz<int, 1, Foo>] [canonicaltypekind=Record] [canonicaltemplateargs/3= [type=int] [typekind=Int]] [isPOD=1] +// CHECK: FieldDecl=baz:28:20 (Definition) [type=Baz<int, 1, Foo>] [typekind=Unexposed] [templateargs/3= [type=int] [typekind=Int]] [canonicaltype=outer::Baz<int, 1, Foo>] [canonicaltypekind=Record] [canonicaltemplateargs/3= [type=int] [typekind=Int]] [isPOD=1] // CHECK: TemplateRef=Baz:9:8 [type=] [typekind=Invalid] [isPOD=0] // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1] // CHECK: TemplateRef=Foo:4:8 [type=] [typekind=Invalid] [isPOD=0] -// CHECK: FieldDecl=qux:28:29 (Definition) [type=Qux<int, char *, Foo<int> >] [typekind=Unexposed] [templateargs/3= [type=int] [typekind=Int] [type=char *] [typekind=Pointer] [type=Foo<int>] [typekind=Unexposed]] [canonicaltype=outer::Qux<int, char *, outer::Foo<int> >] [canonicaltypekind=Record] [canonicaltemplateargs/3= [type=int] [typekind=Int] [type=char *] [typekind=Pointer] [type=outer::Foo<int>] [typekind=Record]] [isPOD=1] +// CHECK: FieldDecl=qux:29:38 (Definition) [type=Qux<int, char *, Foo<int>, outer::inner::Bar::FooType>] [typekind=Unexposed] [templateargs/4= [type=int] [typekind=Int] [type=char *] [typekind=Pointer] [type=Foo<int>] [typekind=Unexposed] [type=outer::inner::Bar::FooType] [typekind=Typedef]] [canonicaltype=outer::Qux<int, char *, outer::Foo<int>, int>] [canonicaltypekind=Record] [canonicaltemplateargs/4= [type=int] [typekind=Int] [type=char *] [typekind=Pointer] [type=outer::Foo<int>] [typekind=Record] [type=int] [typekind=Int]] [isPOD=1] // CHECK: TemplateRef=Qux:12:8 [type=] [typekind=Invalid] [isPOD=0] // CHECK: TemplateRef=Foo:4:8 [type=] [typekind=Invalid] [isPOD=0] -// CHECK: FunctionTemplate=tbar:35:3 [type=T (int)] [typekind=FunctionProto] [canonicaltype=type-parameter-0-0 (int)] [canonicaltypekind=FunctionProto] [resulttype=T] [resulttypekind=Unexposed] [isPOD=0] -// CHECK: TemplateTypeParameter=T:34:20 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] -// CHECK: TypeRef=T:34:20 [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] -// CHECK: ParmDecl=:35:11 (Definition) [type=int] [typekind=Int] [isPOD=1] -// CHECK: FunctionTemplate=tbar:38:3 [type=T (int *)] [typekind=FunctionProto] [canonicaltype=type-parameter-0-0 (int *)] [canonicaltypekind=FunctionProto] [resulttype=T] [resulttypekind=Unexposed] [isPOD=0] -// CHECK: TemplateTypeParameter=T:37:20 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] -// CHECK: TypeRef=T:37:20 [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] -// CHECK: ParmDecl=:38:11 (Definition) [type=int [5]] [typekind=ConstantArray] [isPOD=1] +// CHECK: FunctionTemplate=tbar:36:3 [type=T (int)] [typekind=FunctionProto] [canonicaltype=type-parameter-0-0 (int)] [canonicaltypekind=FunctionProto] [resulttype=T] [resulttypekind=Unexposed] [isPOD=0] +// CHECK: TemplateTypeParameter=T:35:20 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] +// CHECK: TypeRef=T:35:20 [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] +// CHECK: ParmDecl=:36:11 (Definition) [type=int] [typekind=Int] [isPOD=1] +// CHECK: FunctionTemplate=tbar:39:3 [type=T (int *)] [typekind=FunctionProto] [canonicaltype=type-parameter-0-0 (int *)] [canonicaltypekind=FunctionProto] [resulttype=T] [resulttypekind=Unexposed] [isPOD=0] +// CHECK: TemplateTypeParameter=T:38:20 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] +// CHECK: TypeRef=T:38:20 [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] +// CHECK: ParmDecl=:39:11 (Definition) [type=int [5]] [typekind=ConstantArray] [isPOD=1] // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1] -// CHECK: FunctionTemplate=tbar:41:3 [type=T (int *)] [typekind=FunctionProto] [canonicaltype=type-parameter-0-0 (int *)] [canonicaltypekind=FunctionProto] [resulttype=T] [resulttypekind=Unexposed] [isPOD=0] -// CHECK: TemplateTypeParameter=T:40:20 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] -// CHECK: NonTypeTemplateParameter=size:40:27 (Definition) [type=int] [typekind=Int] [isPOD=1] -// CHECK: TypeRef=T:40:20 [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] -// CHECK: ParmDecl=:41:11 (Definition) [type=int [size]] [typekind=DependentSizedArray] [isPOD=0] -// CHECK: DeclRefExpr=size:40:27 [type=int] [typekind=Int] [isPOD=1] -// CHECK: FunctionDecl=foo:43:6 (Definition) [type=void (int, int *)] [typekind=FunctionProto] [canonicaltype=void (int, int *)] [canonicaltypekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [args= [int] [Int] [int []] [IncompleteArray]] [isPOD=0] -// CHECK: ParmDecl=i:43:14 (Definition) [type=int] [typekind=Int] [isPOD=1] -// CHECK: ParmDecl=incomplete_array:43:21 (Definition) [type=int []] [typekind=IncompleteArray] [isPOD=1] +// CHECK: FunctionTemplate=tbar:42:3 [type=T (int *)] [typekind=FunctionProto] [canonicaltype=type-parameter-0-0 (int *)] [canonicaltypekind=FunctionProto] [resulttype=T] [resulttypekind=Unexposed] [isPOD=0] +// CHECK: TemplateTypeParameter=T:41:20 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] +// CHECK: NonTypeTemplateParameter=size:41:27 (Definition) [type=int] [typekind=Int] [isPOD=1] +// CHECK: TypeRef=T:41:20 [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] +// CHECK: ParmDecl=:42:11 (Definition) [type=int [size]] [typekind=DependentSizedArray] [isPOD=0] +// CHECK: DeclRefExpr=size:41:27 [type=int] [typekind=Int] [isPOD=1] +// CHECK: FunctionDecl=foo:44:6 (Definition) [type=void (int, int *)] [typekind=FunctionProto] [canonicaltype=void (int, int *)] [canonicaltypekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [args= [int] [Int] [int []] [IncompleteArray]] [isPOD=0] +// CHECK: ParmDecl=i:44:14 (Definition) [type=int] [typekind=Int] [isPOD=1] +// CHECK: ParmDecl=incomplete_array:44:21 (Definition) [type=int []] [typekind=IncompleteArray] [isPOD=1] // CHECK: CompoundStmt= [type=] [typekind=Invalid] [isPOD=0] // CHECK: DeclStmt= [type=] [typekind=Invalid] [isPOD=0] -// CHECK: VarDecl=variable_array:43:47 (Definition) [type=int [i]] [typekind=VariableArray] [isPOD=1] -// CHECK: DeclRefExpr=i:43:14 [type=int] [typekind=Int] [isPOD=1] -// CHECK: StructDecl=Blob:45:8 (Definition) [type=Blob] [typekind=Record] [isPOD=1] [nbFields=2] -// CHECK: FieldDecl=i:46:7 (Definition) [type=int] [typekind=Int] [isPOD=1] -// CHECK: VarDecl=member_pointer:49:12 (Definition) [type=int Blob::*] [typekind=MemberPointer] [isPOD=1] -// CHECK: FunctionDecl=elaboratedNamespaceType:51:42 [type=NS::Type (const NS::Type)] [typekind=FunctionProto] [canonicaltype=NS::Type (NS::Type)] [canonicaltypekind=FunctionProto] [resulttype=NS::Type] [resulttypekind=Elaborated] [args= [const NS::Type] [Elaborated]] [isPOD=0] -// CHECK: NamespaceRef=NS:51:11 [type=] [typekind=Invalid] [isPOD=0] -// CHECK: TypeRef=struct NS::Type:51:23 [type=NS::Type] [typekind=Record] [isPOD=1] -// CHECK: ParmDecl=t:51:81 (Definition) [type=const NS::Type] [typekind=Elaborated] const [canonicaltype=const NS::Type] [canonicaltypekind=Record] [isPOD=1] -// CHECK: VarDecl=autoI:53:6 (Definition) [type=int] [typekind=Auto] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: VarDecl=variable_array:44:47 (Definition) [type=int [i]] [typekind=VariableArray] [isPOD=1] +// CHECK: DeclRefExpr=i:44:14 [type=int] [typekind=Int] [isPOD=1] +// CHECK: StructDecl=Blob:46:8 (Definition) [type=Blob] [typekind=Record] [isPOD=1] [nbFields=2] +// CHECK: FieldDecl=i:47:7 (Definition) [type=int] [typekind=Int] [isPOD=1] +// CHECK: VarDecl=member_pointer:50:12 (Definition) [type=int Blob::*] [typekind=MemberPointer] [isPOD=1] +// CHECK: FunctionDecl=elaboratedNamespaceType:52:42 [type=NS::Type (const NS::Type)] [typekind=FunctionProto] [canonicaltype=NS::Type (NS::Type)] [canonicaltypekind=FunctionProto] [resulttype=NS::Type] [resulttypekind=Elaborated] [args= [const NS::Type] [Elaborated]] [isPOD=0] +// CHECK: NamespaceRef=NS:52:11 [type=] [typekind=Invalid] [isPOD=0] +// CHECK: TypeRef=struct NS::Type:52:23 [type=NS::Type] [typekind=Record] [isPOD=1] +// CHECK: ParmDecl=t:52:81 (Definition) [type=const NS::Type] [typekind=Elaborated] const [canonicaltype=const NS::Type] [canonicaltypekind=Record] [isPOD=1] +// CHECK: VarDecl=autoI:54:6 (Definition) [type=int] [typekind=Auto] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1] -// CHECK: VarDecl=autoTbar:54:6 (Definition) [type=int] [typekind=Auto] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] -// CHECK: CallExpr=tbar:35:3 [type=int] [typekind=Unexposed] [canonicaltype=int] [canonicaltypekind=Int] [args= [int] [Int]] [isPOD=1] -// CHECK: UnexposedExpr=tbar:35:3 [type=int (*)(int)] [typekind=Pointer] [canonicaltype=int (*)(int)] [canonicaltypekind=Pointer] [isPOD=1] [pointeetype=int (int)] [pointeekind=FunctionProto] -// CHECK: DeclRefExpr=tbar:35:3 RefName=[54:17 - 54:21] RefName=[54:21 - 54:26] [type=int (int)] [typekind=FunctionProto] [canonicaltype=int (int)] [canonicaltypekind=FunctionProto] [isPOD=0] +// CHECK: VarDecl=autoTbar:55:6 (Definition) [type=int] [typekind=Auto] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: CallExpr=tbar:36:3 [type=int] [typekind=Unexposed] [canonicaltype=int] [canonicaltypekind=Int] [args= [int] [Int]] [isPOD=1] +// CHECK: UnexposedExpr=tbar:36:3 [type=int (*)(int)] [typekind=Pointer] [canonicaltype=int (*)(int)] [canonicaltypekind=Pointer] [isPOD=1] [pointeetype=int (int)] [pointeekind=FunctionProto] +// CHECK: DeclRefExpr=tbar:36:3 RefName=[55:17 - 55:21] RefName=[55:21 - 55:26] [type=int (int)] [typekind=FunctionProto] [canonicaltype=int (int)] [canonicaltypekind=FunctionProto] [isPOD=0] // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1] -// CHECK: VarDecl=autoBlob:55:6 (Definition) [type=Blob *] [typekind=Auto] [canonicaltype=Blob *] [canonicaltypekind=Pointer] [isPOD=1] +// CHECK: VarDecl=autoBlob:56:6 (Definition) [type=Blob *] [typekind=Auto] [canonicaltype=Blob *] [canonicaltypekind=Pointer] [isPOD=1] // CHECK: CXXNewExpr= [type=Blob *] [typekind=Pointer] [isPOD=1] [pointeetype=Blob] [pointeekind=Record] -// CHECK: TypeRef=struct Blob:45:8 [type=Blob] [typekind=Record] [isPOD=1] [nbFields=2] -// CHECK: CallExpr=Blob:45:8 [type=Blob] [typekind=Record] [isPOD=1] [nbFields=2] -// CHECK: FunctionDecl=autoFunction:56:6 (Definition) [type=int ()] [typekind=FunctionProto] [canonicaltype=int ()] [canonicaltypekind=FunctionProto] [resulttype=int] [resulttypekind=Auto] [isPOD=0] +// CHECK: TypeRef=struct Blob:46:8 [type=Blob] [typekind=Record] [isPOD=1] [nbFields=2] +// CHECK: CallExpr=Blob:46:8 [type=Blob] [typekind=Record] [isPOD=1] [nbFields=2] +// CHECK: FunctionDecl=autoFunction:57:6 (Definition) [type=int ()] [typekind=FunctionProto] [canonicaltype=int ()] [canonicaltypekind=FunctionProto] [resulttype=int] [resulttypekind=Auto] [isPOD=0] // CHECK: CompoundStmt= [type=] [typekind=Invalid] [isPOD=0] // CHECK: ReturnStmt= [type=] [typekind=Invalid] [isPOD=0] // CHECK: UnexposedExpr= [type=int] [typekind=Int] [isPOD=1] -// CHECK: VarDecl=autoInt:57:16 (Definition) [type=int] [typekind=Auto] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: VarDecl=autoInt:58:16 (Definition) [type=int] [typekind=Auto] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1] -// CHECK: TypeAliasTemplateDecl=TypeAlias:60:1 (Definition) [type=] [typekind=Invalid] [isPOD=0] -// CHECK: TemplateTypeParameter=T:59:20 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] -// CHECK: FieldDecl=foo:62:39 (Definition) [type=TypeAlias<int>] [typekind=Unexposed] [templateargs/1= [type=int] [typekind=Int]] [canonicaltype=outer::Qux<int>] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=int] [typekind=Int]] [isPOD=1] -// CHECK: TemplateRef=TypeAlias:60:1 [type=] [typekind=Invalid] [isPOD=0] -// CHECK: ClassTemplate=Specialization:65:8 (Definition) [type=] [typekind=Invalid] [isPOD=0] -// CHECK: TemplateTypeParameter=T:64:19 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] -// CHECK: StructDecl=Specialization:68:8 [Specialization of Specialization:65:8] [type=Specialization<int>] [typekind=Record] [templateargs/1= [type=int] [typekind=Int]] [isPOD=0] -// CHECK: VarDecl=templRefParam:70:40 (Definition) [type=Specialization<Specialization<bool> &>] [typekind=Unexposed] [templateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [canonicaltype=Specialization<Specialization<bool> &>] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [isPOD=1] -// CHECK: TemplateRef=Specialization:65:8 [type=] [typekind=Invalid] [isPOD=0] -// CHECK: CallExpr=Specialization:65:8 [type=Specialization<Specialization<bool> &>] [typekind=Unexposed] [templateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [canonicaltype=Specialization<Specialization<bool> &>] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [isPOD=1] -// CHECK: VarDecl=autoTemplRefParam:71:6 (Definition) [type=Specialization<Specialization<bool> &>] [typekind=Auto] [templateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [canonicaltype=Specialization<Specialization<bool> &>] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [isPOD=1] -// CHECK: UnexposedExpr=templRefParam:70:40 [type=const Specialization<Specialization<bool> &>] [typekind=Unexposed] const [templateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [canonicaltype=const Specialization<Specialization<bool> &>] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [isPOD=1] -// CHECK: DeclRefExpr=templRefParam:70:40 [type=Specialization<Specialization<bool> &>] [typekind=Unexposed] [templateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [canonicaltype=Specialization<Specialization<bool> &>] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [isPOD=1] +// CHECK: TypeAliasTemplateDecl=TypeAlias:61:1 (Definition) [type=] [typekind=Invalid] [isPOD=0] +// CHECK: TemplateTypeParameter=T:60:20 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] +// CHECK: FieldDecl=foo:63:39 (Definition) [type=TypeAlias<int>] [typekind=Unexposed] [templateargs/1= [type=int] [typekind=Int]] [canonicaltype=outer::Qux<int>] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=int] [typekind=Int]] [isPOD=1] +// CHECK: TemplateRef=TypeAlias:61:1 [type=] [typekind=Invalid] [isPOD=0] +// CHECK: ClassTemplate=Specialization:66:8 (Definition) [type=] [typekind=Invalid] [isPOD=0] +// CHECK: TemplateTypeParameter=T:65:19 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] +// CHECK: StructDecl=Specialization:69:8 [Specialization of Specialization:66:8] [type=Specialization<int>] [typekind=Record] [templateargs/1= [type=int] [typekind=Int]] [isPOD=0] +// CHECK: VarDecl=templRefParam:71:40 (Definition) [type=Specialization<Specialization<bool> &>] [typekind=Unexposed] [templateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [canonicaltype=Specialization<Specialization<bool> &>] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [isPOD=1] +// CHECK: TemplateRef=Specialization:66:8 [type=] [typekind=Invalid] [isPOD=0] +// CHECK: CallExpr=Specialization:66:8 [type=Specialization<Specialization<bool> &>] [typekind=Unexposed] [templateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [canonicaltype=Specialization<Specialization<bool> &>] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [isPOD=1] +// CHECK: VarDecl=autoTemplRefParam:72:6 (Definition) [type=Specialization<Specialization<bool> &>] [typekind=Auto] [templateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [canonicaltype=Specialization<Specialization<bool> &>] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [isPOD=1] +// CHECK: UnexposedExpr=templRefParam:71:40 [type=const Specialization<Specialization<bool> &>] [typekind=Unexposed] const [templateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [canonicaltype=const Specialization<Specialization<bool> &>] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [isPOD=1] +// CHECK: DeclRefExpr=templRefParam:71:40 [type=Specialization<Specialization<bool> &>] [typekind=Unexposed] [templateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [canonicaltype=Specialization<Specialization<bool> &>] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=Specialization<bool> &] [typekind=LValueReference]] [isPOD=1] diff --git a/test/Index/recursive-cxx-member-calls.cpp b/test/Index/recursive-cxx-member-calls.cpp index 36d617f48b09d..9dd2d67254f2f 100644 --- a/test/Index/recursive-cxx-member-calls.cpp +++ b/test/Index/recursive-cxx-member-calls.cpp @@ -536,7 +536,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: ")" [49:73 - 49:74] CXXConstructor=StringRef:49:3 (Definition) // CHECK-tokens: Punctuation: "{" [49:75 - 49:76] CompoundStmt= // CHECK-tokens: Punctuation: "}" [49:76 - 49:77] CompoundStmt= -// CHECK-tokens: Identifier: "iterator" [50:3 - 50:11] TypeRef=iterator:40:23 +// CHECK-tokens: Identifier: "iterator" [50:3 - 50:11] TypeRef=llvm::StringRef::iterator:40:23 // CHECK-tokens: Identifier: "end" [50:12 - 50:15] CXXMethod=end:50:12 (Definition) // CHECK-tokens: Punctuation: "(" [50:15 - 50:16] CXXMethod=end:50:12 (Definition) // CHECK-tokens: Punctuation: ")" [50:16 - 50:17] CXXMethod=end:50:12 (Definition) @@ -1681,7 +1681,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 49:67: DeclRefExpr=length:49:38 Extent=[49:67 - 49:73] // CHECK: 49:75: CompoundStmt= Extent=[49:75 - 49:77] // CHECK: 50:12: CXXMethod=end:50:12 (Definition) (const) Extent=[50:3 - 50:40] [access=public] -// CHECK: 50:3: TypeRef=iterator:40:23 Extent=[50:3 - 50:11] +// CHECK: 50:3: TypeRef=llvm::StringRef::iterator:40:23 Extent=[50:3 - 50:11] // CHECK: 50:24: CompoundStmt= Extent=[50:24 - 50:40] // CHECK: 50:26: ReturnStmt= Extent=[50:26 - 50:37] // CHECK: 50:33: MemberRefExpr=Data:43:15 Extent=[50:33 - 50:37] |