diff options
author | Jordan Rupprecht <rupprecht@google.com> | 2019-05-14 21:58:59 +0000 |
---|---|---|
committer | Jordan Rupprecht <rupprecht@google.com> | 2019-05-14 21:58:59 +0000 |
commit | b35a2aa71f76a334a9c98c0a3c3995b5d902d2b9 (patch) | |
tree | cdff4a5d1a715d4ad622fd8f190128b54bebe440 /test/Index | |
parent | 3748d41833787fcbf59cc5624e8d2b042a8991bc (diff) | |
parent | 741e05796da92b46d4f7bcbee00702ff37df6489 (diff) |
Creating branches/google/stable and tags/google/stable/2019-05-14 from r360103upstream/google/stable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/google/stable@360714 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index')
-rw-r--r-- | test/Index/Core/index-source.cpp | 30 | ||||
-rw-r--r-- | test/Index/Inputs/keep-going-template-instantiations.h | 3 | ||||
-rw-r--r-- | test/Index/attributes.c | 27 | ||||
-rw-r--r-- | test/Index/comment-objc-decls.m | 6 | ||||
-rw-r--r-- | test/Index/comment-unqualified-objc-pointer.m | 2 | ||||
-rw-r--r-- | test/Index/complete-blocks.m | 12 | ||||
-rw-r--r-- | test/Index/index-refs.cpp | 2 | ||||
-rw-r--r-- | test/Index/keep-going-template-instantiations.cpp | 5 | ||||
-rw-r--r-- | test/Index/keep-going.cpp | 4 | ||||
-rw-r--r-- | test/Index/missing_vfs.c | 6 | ||||
-rw-r--r-- | test/Index/ms-property.cpp | 32 | ||||
-rw-r--r-- | test/Index/opencl-types.cl | 6 | ||||
-rw-r--r-- | test/Index/pch-from-libclang.c | 11 | ||||
-rw-r--r-- | test/Index/print-display-names.cpp | 2 | ||||
-rw-r--r-- | test/Index/print-type-size.cpp | 6 | ||||
-rw-r--r-- | test/Index/print-type.c | 18 | ||||
-rw-r--r-- | test/Index/print-type.m | 2 | ||||
-rw-r--r-- | test/Index/usrs.cpp | 2 |
18 files changed, 143 insertions, 33 deletions
diff --git a/test/Index/Core/index-source.cpp b/test/Index/Core/index-source.cpp index 0bf663e30b..b57b156072 100644 --- a/test/Index/Core/index-source.cpp +++ b/test/Index/Core/index-source.cpp @@ -5,17 +5,17 @@ class Cls { public: // 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 + // CHECK: [[@LINE+1]]:3 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont,NameReference | rel: 1 Cls(int x); // 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 + // CHECK: [[@LINE+1]]:3 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont,NameReference | rel: 1 Cls(const Cls &); // 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 + // CHECK: [[@LINE+1]]:3 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont,NameReference | 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 + // CHECK: [[@LINE+1]]:4 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont,NameReference | rel: 1 ~Cls(); }; @@ -35,12 +35,12 @@ 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 +// CHECK: [[@LINE-3]]:6 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont,NameReference | 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 +// CHECK: [[@LINE-3]]:20 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont,NameReference | rel: 1 template <typename TemplArg> class TemplCls { @@ -212,7 +212,7 @@ class PseudoOverridesInSpecializations<double, int>::InnerClass { }; // CHECK: [[@LINE-2]]:54 | class(Gen)/C++ | InnerClass | c:@S@PseudoOverridesInSpecializations>#d#I@ST>1#T@InnerClass | <no-cgname> | Def,RelChild | rel: 1 // CHECK-NEXT: RelChild -// CHECK: [[@LINE-4]]:7 | class(Gen)/C++ | PseudoOverridesInSpecializations | c:@ST>2#T#T@PseudoOverridesInSpecializations | <no-cgname> | Ref,RelCont | rel: 1 +// CHECK: [[@LINE-4]]:7 | class(Gen,TS)/C++ | PseudoOverridesInSpecializations | c:@S@PseudoOverridesInSpecializations>#d#I | <no-cgname> | Ref,RelCont | rel: 1 // CHECK-NEXT: RelCont template<typename S> @@ -285,13 +285,13 @@ template<> class SpecializationDecl<int>; // CHECK: [[@LINE-1]]:7 | class(Gen,TS)/C++ | SpecializationDecl | c:@S@SpecializationDecl>#I | <no-cgname> | Decl,RelSpecialization | rel: 1 // CHECK-NEXT: RelSpecialization | SpecializationDecl | c:@ST>1#T@SpecializationDecl -// CHECK: [[@LINE-3]]:7 | class(Gen)/C++ | SpecializationDecl | c:@ST>1#T@SpecializationDecl | <no-cgname> | Ref | rel: 0 +// CHECK: [[@LINE-3]]:7 | class(Gen,TS)/C++ | SpecializationDecl | c:@S@SpecializationDecl>#I | <no-cgname> | Ref | rel: 0 template<> class SpecializationDecl<int> { }; // CHECK: [[@LINE-1]]:7 | class(Gen,TS)/C++ | SpecializationDecl | c:@S@SpecializationDecl>#I | <no-cgname> | Def,RelSpecialization | rel: 1 // CHECK-NEXT: RelSpecialization | SpecializationDecl | c:@ST>1#T@SpecializationDecl -// CHECK-NEXT: [[@LINE-3]]:7 | class(Gen)/C++ | SpecializationDecl | c:@ST>1#T@SpecializationDecl | <no-cgname> | Ref | rel: 0 +// CHECK-NEXT: [[@LINE-3]]:7 | class(Gen,TS)/C++ | SpecializationDecl | c:@S@SpecializationDecl>#I | <no-cgname> | Ref | rel: 0 template<typename T> class PartialSpecilizationClass<Cls, T>; @@ -306,7 +306,7 @@ class PartialSpecilizationClass<Cls, Cls> : Cls { }; // CHECK-NEXT: RelSpecialization | PartialSpecilizationClass | c:@ST>2#T#T@PartialSpecilizationClass // CHECK-NEXT: [[@LINE-3]]:45 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelBase,RelCont | rel: 1 // CHECK-NEXT: RelBase,RelCont | PartialSpecilizationClass | c:@S@PartialSpecilizationClass>#$@S@Cls#S0_ -// CHECK-NEXT: [[@LINE-5]]:7 | class(Gen)/C++ | PartialSpecilizationClass | c:@ST>2#T#T@PartialSpecilizationClass | <no-cgname> | Ref | rel: 0 +// CHECK-NEXT: [[@LINE-5]]:7 | class(Gen,TS)/C++ | PartialSpecilizationClass | c:@S@PartialSpecilizationClass>#$@S@Cls#S0_ | <no-cgname> | Ref | rel: 0 // CHECK-NEXT: [[@LINE-6]]:33 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref | rel: 0 // CHECK-NEXT: [[@LINE-7]]:38 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref | rel: 0 @@ -321,7 +321,7 @@ template<> void functionSp<SpecializationDecl<Cls>, Record::C>() { // CHECK: [[@LINE-1]]:6 | function(Gen,TS)/C++ | functionSp | c:@F@functionSp<#$@S@SpecializationDecl>#$@S@Cls#VI2># | __Z10functionSpI18SpecializationDeclI3ClsELi2EEvv | Def,RelSpecialization | rel: 1 // CHECK: RelSpecialization | functionSp | c:@FT@>2#T#NIfunctionSp#v# -// CHECK: [[@LINE-3]]:17 | class(Gen)/C++ | SpecializationDecl | c:@ST>1#T@SpecializationDecl | <no-cgname> | Ref,RelCont | rel: 1 +// CHECK: [[@LINE-3]]:17 | class(Gen,TS)/C++ | SpecializationDecl | c:@S@SpecializationDecl>#$@S@Cls | <no-cgname> | Ref,RelCont | rel: 1 // CHECK: [[@LINE-4]]:36 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref,RelCont | rel: 1 // CHECK: [[@LINE-5]]:50 | static-property/C++ | C | c:@S@Record@C | __ZN6Record1CE | Ref,RelCont | rel: 1 // CHECK: [[@LINE-6]]:42 | struct/C++ | Record | c:@S@Record | <no-cgname> | Ref,RelCont | rel: 1 @@ -332,7 +332,7 @@ class ClassWithCorrectSpecialization { }; template<> class ClassWithCorrectSpecialization<SpecializationDecl<Cls>, Record::C> { }; -// CHECK: [[@LINE-1]]:38 | class(Gen)/C++ | SpecializationDecl | c:@ST>1#T@SpecializationDecl | <no-cgname> | Ref | rel: 0 +// CHECK: [[@LINE-1]]:38 | class(Gen,TS)/C++ | SpecializationDecl | c:@S@SpecializationDecl>#$@S@Cls | <no-cgname> | Ref | rel: 0 // CHECK: [[@LINE-2]]:57 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Ref | rel: 0 // CHECK: [[@LINE-3]]:71 | static-property/C++ | C | c:@S@Record@C | __ZN6Record1CE | Ref,Read | rel: 0 // CHECK: [[@LINE-4]]:63 | struct/C++ | Record | c:@S@Record | <no-cgname> | Ref | rel: 0 @@ -394,7 +394,7 @@ struct DeletedMethods { // CHECK: [[@LINE-1]]:3 | constructor/cxx-copy-ctor/C++ | DeletedMethods | c:@S@DeletedMethods@F@DeletedMethods#&1$@S@DeletedMethods# | __ZN14DeletedMethodsC1ERKS_ | Def,RelChild | rel: 1 // CHECK: RelChild | DeletedMethods | c:@S@DeletedMethods // CHECK: [[@LINE-3]]:24 | struct/C++ | DeletedMethods | c:@S@DeletedMethods | <no-cgname> | Ref,RelCont | rel: 1 -// CHECK: [[@LINE-4]]:3 | struct/C++ | DeletedMethods | c:@S@DeletedMethods | <no-cgname> | Ref,RelCont | rel: 1 +// CHECK: [[@LINE-4]]:3 | struct/C++ | DeletedMethods | c:@S@DeletedMethods | <no-cgname> | Ref,RelCont,NameReference | rel: 1 }; namespace ns2 { @@ -494,7 +494,7 @@ void localStructuredBindingAndRef() { // CHECK: [[@LINE-1]]:69 | variable/C++ | structuredBinding2 | c:@N@cpp17structuredBinding@structuredBinding2 | <no-cgname> | Ref,Read,RelCont | rel: 1 // CHECK-NEXT: RelCont | localStructuredBindingAndRef | c:@N@cpp17structuredBinding@F@localStructuredBindingAndRef# // CHECK-NOT: localBinding -// LOCAL: [[@LINE-4]]:9 | variable(local)/C++ | localBinding1 | c:index-source.cpp@25382@N@cpp17structuredBinding@F@localStructuredBindingAndRef#@localBinding1 +// LOCAL: [[@LINE-4]]:9 | variable(local)/C++ | localBinding1 | c:index-source.cpp@{{.*}}@N@cpp17structuredBinding@F@localStructuredBindingAndRef#@localBinding1 } } @@ -505,7 +505,7 @@ struct Guided { T t; }; // CHECK-NEXT: [[@LINE-2]]:19 | field/C++ | t | c:@ST>1#T@Guided@FI@t | <no-cgname> | Def,RelChild | rel: 1 // CHECK-NEXT: RelChild | Guided | c:@ST>1#T@Guided Guided(double) -> Guided<float>; -// CHECK: [[@LINE-1]]:19 | struct(Gen)/C++ | Guided | c:@ST>1#T@Guided | <no-cgname> | Ref | rel: 0 +// CHECK: [[@LINE-1]]:19 | struct(Gen,TS)/C++ | Guided | c:@S@Guided>#f | <no-cgname> | Ref | rel: 0 // CHECK-NEXT: [[@LINE-2]]:1 | struct(Gen)/C++ | Guided | c:@ST>1#T@Guided | <no-cgname> | Ref | rel: 0 auto guided = Guided{1.0}; // CHECK: [[@LINE-1]]:6 | variable/C | guided | c:@guided | _guided | Def | rel: 0 diff --git a/test/Index/Inputs/keep-going-template-instantiations.h b/test/Index/Inputs/keep-going-template-instantiations.h new file mode 100644 index 0000000000..042918b1f8 --- /dev/null +++ b/test/Index/Inputs/keep-going-template-instantiations.h @@ -0,0 +1,3 @@ +template<typename T, T v> struct c {}; +using d = c<bool, false>; +struct foo : public d {}; diff --git a/test/Index/attributes.c b/test/Index/attributes.c index e3b2c1ab7a..a5d10a1835 100644 --- a/test/Index/attributes.c +++ b/test/Index/attributes.c @@ -12,6 +12,22 @@ enum __attribute((flag_enum)) FlagEnum { Foo }; +void convergent_fn() __attribute__((convergent)); + +int warn_unused_result_fn() __attribute__((warn_unused_result)); + +struct __attribute__((warn_unused)) WarnUnused { + int b; +}; + +struct __attribute__((aligned(64))) Aligned1 { + int c; +}; + +struct Aligned2 { + int c; +} __attribute__((aligned(64))); + // CHECK: attributes.c:3:32: StructDecl=Test2:3:32 (Definition) Extent=[3:1 - 5:2] // CHECK: attributes.c:3:23: attribute(packed)=packed Extent=[3:23 - 3:29] // CHECK: attributes.c:4:8: FieldDecl=a:4:8 (Definition) Extent=[4:3 - 4:9] [access=public] @@ -24,3 +40,14 @@ enum __attribute((flag_enum)) FlagEnum { // CHECK: attributes.c:9:38: attribute(noduplicate)= Extent=[9:38 - 9:49] // CHECK: attributes.c:11:31: EnumDecl=FlagEnum:11:31 (Definition) Extent=[11:1 - 13:2] // CHECK: attributes.c:11:19: attribute(flag_enum)= Extent=[11:19 - 11:28] +// CHECK: attributes.c:12:3: EnumConstantDecl=Foo:12:3 (Definition) Extent=[12:3 - 12:6] +// CHECK: attributes.c:15:6: FunctionDecl=convergent_fn:15:6 Extent=[15:1 - 15:49] +// CHECK: attributes.c:15:37: attribute(convergent)= Extent=[15:37 - 15:47] +// CHECK: attributes.c:17:5: FunctionDecl=warn_unused_result_fn:17:5 Extent=[17:1 - 17:64] +// CHECK: attributes.c:17:44: attribute(warn_unused_result)= Extent=[17:44 - 17:62] +// CHECK: attributes.c:19:37: StructDecl=WarnUnused:19:37 (Definition) Extent=[19:1 - 21:2] +// CHECK: attributes.c:19:23: attribute(warn_unused)= Extent=[19:23 - 19:34] +// CHECK: attributes.c:23:37: StructDecl=Aligned1:23:37 (Definition) Extent=[23:1 - 25:2] +// CHECK: attributes.c:23:23: attribute(aligned)= Extent=[23:23 - 23:34] +// CHECK: attributes.c:27:8: StructDecl=Aligned2:27:8 (Definition) Extent=[27:1 - 29:2] +// CHECK: attributes.c:29:18: attribute(aligned)= Extent=[29:18 - 29:29] diff --git a/test/Index/comment-objc-decls.m b/test/Index/comment-objc-decls.m index d53757cbc3..c93ad44a05 100644 --- a/test/Index/comment-objc-decls.m +++ b/test/Index/comment-objc-decls.m @@ -32,7 +32,7 @@ @end // CHECK: <Declaration>@protocol MyProto\n@end</Declaration> // CHECK: <Declaration>- (unsigned int)MethodMyProto:(nullable id)anObject inRange:(unsigned int)range;</Declaration> -// CHECK: <Declaration>@optional\n@property(readwrite, copy, atomic, nonnull) id PropertyMyProto;</Declaration> +// CHECK: <Declaration>@optional\n@property(atomic, copy, readwrite, nonnull) id PropertyMyProto;</Declaration> // CHECK: <Declaration>+ (id)ClassMethodMyProto;</Declaration> /** @@ -77,7 +77,7 @@ // CHECK: <Declaration>id IvarMyClass</Declaration> // CHECK: <Declaration>- (id)MethodMyClass;</Declaration> // CHECK: <Declaration>+ (id)ClassMethodMyClass;</Declaration> -// CHECK: <Declaration>@property(readwrite, copy, atomic) id PropertyMyClass;</Declaration +// CHECK: <Declaration>@property(atomic, copy, readwrite) id PropertyMyClass;</Declaration /** * \brief - This is class extension of MyClass @@ -110,7 +110,7 @@ @end // CHECK: <Declaration>@interface MyClass (Category)\n@end</Declaration> // CHECK: <Declaration>- (void)MethodMyClassCategory;</Declaration> -// CHECK: <Declaration>@property(readwrite, copy, atomic) id PropertyMyClassCategory;</Declaration> +// CHECK: <Declaration>@property(atomic, copy, readwrite) id PropertyMyClassCategory;</Declaration> // CHECK: <Declaration>- (id)PropertyMyClassCategory;</Declaration> // CHECK: <Declaration>- (void)setPropertyMyClassCategory:(id)arg;</Declaration> diff --git a/test/Index/comment-unqualified-objc-pointer.m b/test/Index/comment-unqualified-objc-pointer.m index e9e1ceee23..cf297ef855 100644 --- a/test/Index/comment-unqualified-objc-pointer.m +++ b/test/Index/comment-unqualified-objc-pointer.m @@ -19,7 +19,7 @@ //! This is a property to get the Name. @property (copy) NSString *Name; -// CHECK: <Declaration>@property(readwrite, copy, atomic) NSString *Name;</Declaration> +// CHECK: <Declaration>@property(atomic, copy, readwrite) NSString *Name;</Declaration> @end @implementation NSMutableArray diff --git a/test/Index/complete-blocks.m b/test/Index/complete-blocks.m index 046a08695d..9c6c1cbf86 100644 --- a/test/Index/complete-blocks.m +++ b/test/Index/complete-blocks.m @@ -50,6 +50,15 @@ void test_f2(I1 *o) { [o method7:0]; } +// Crash regression test. Param info for broken function types isn't available. +typedef UnresolvedType *(^XXX)(float); +@interface Foo +-(void) foo:(XXX)arg; +@end +void testUnresolved(Foo* f) { + [f foo: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) @@ -74,3 +83,6 @@ void test_f2(I1 *o) { // CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f2}{LeftParen (}{Placeholder ^int(int x, int y)block}{RightParen )} (50) // RUN: c-index-test -code-completion-at=%s:50:6 %s | FileCheck -check-prefix=CHECK-CC8 %s // CHECK-CC8: ObjCInstanceMethodDecl:{ResultType id}{TypedText method7:}{Placeholder ^int(int x, int y)b} (35) + +// RUN: c-index-test -code-completion-at=%s:59:6 %s | FileCheck -check-prefix=CHECK-CC9 %s +// CHECK-CC9: ObjCInstanceMethodDecl:{ResultType void}{TypedText foo:}{Placeholder ^int *(int)arg} (35) diff --git a/test/Index/index-refs.cpp b/test/Index/index-refs.cpp index 760e4cfcf9..0e613e4852 100644 --- a/test/Index/index-refs.cpp +++ b/test/Index/index-refs.cpp @@ -117,7 +117,7 @@ int ginitlist[] = {EnumVal}; /* 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-NEXT: [indexEntityReference]: kind: struct-template-partial-spec | name: TS | USR: c:@SP>1#T@TS>#t0.0#I | {{.*}} | loc: 55:3 // CHECK: [indexEntityReference]: kind: variable | name: array_size | {{.*}} | loc: 59:22 // CHECK: [indexEntityReference]: kind: variable | name: default_param | {{.*}} | loc: 62:19 | {{.*}} | role: ref read diff --git a/test/Index/keep-going-template-instantiations.cpp b/test/Index/keep-going-template-instantiations.cpp new file mode 100644 index 0000000000..7deef2120e --- /dev/null +++ b/test/Index/keep-going-template-instantiations.cpp @@ -0,0 +1,5 @@ +#include "missing.h" +#include <keep-going-template-instantiations.h> + +// RUN: env CINDEXTEST_KEEP_GOING=1 c-index-test -test-load-source none -I%S/Inputs %s 2>&1 | FileCheck %s +// CHECK-NOT: error: expected class name diff --git a/test/Index/keep-going.cpp b/test/Index/keep-going.cpp index b3f29c5d3d..0b2df725a5 100644 --- a/test/Index/keep-going.cpp +++ b/test/Index/keep-going.cpp @@ -34,5 +34,5 @@ class C : public A<float> { }; // CHECK-KEEP-GOING-ONLY: VarDecl=global_var:1:12 [type=int] [typekind=Int] [isPOD=1] -// CHECK-DIAG: keep-going.cpp:1:10: fatal error: 'missing1.h' file not found -// CHECK-DIAG: keep-going.cpp:8:10: fatal error: 'missing2.h' file not found +// CHECK-DIAG: keep-going.cpp:1:10: error: 'missing1.h' file not found +// CHECK-DIAG: keep-going.cpp:8:10: error: 'missing2.h' file not found diff --git a/test/Index/missing_vfs.c b/test/Index/missing_vfs.c index 61aedd41cf..f3baf33d8d 100644 --- a/test/Index/missing_vfs.c +++ b/test/Index/missing_vfs.c @@ -1,6 +1,6 @@ -// RUN: c-index-test -test-load-source local %s -ivfsoverlay %t/does-not-exist.yaml &> %t.out -// RUN: FileCheck -check-prefix=STDERR %s < %t.out +// RUN: c-index-test -test-load-source local %s -ivfsoverlay %t/does-not-exist.yaml > %t.stdout 2> %t.stderr +// RUN: FileCheck -check-prefix=STDERR %s < %t.stderr // STDERR: fatal error: virtual filesystem overlay file '{{.*}}' not found -// RUN: FileCheck %s < %t.out +// RUN: FileCheck %s < %t.stdout // CHECK: missing_vfs.c:[[@LINE+1]]:6: FunctionDecl=foo:[[@LINE+1]]:6 void foo(void); diff --git a/test/Index/ms-property.cpp b/test/Index/ms-property.cpp new file mode 100644 index 0000000000..74b5b1399c --- /dev/null +++ b/test/Index/ms-property.cpp @@ -0,0 +1,32 @@ +// RUN: c-index-test core -print-source-symbols -- -target x86_64-apple-darwin10 -fms-extensions -fno-ms-compatibility %s | FileCheck %s + +// CHECK: [[@LINE+1]]:8 | struct/C++ | Simple | [[Simple_USR:.*]] | <no-cgname> | Def | rel: 0 +struct Simple { + int GetX() const; + // CHECK: [[@LINE-1]]:7 | instance-method/C++ | GetX | [[GetX_USR:.*]] | __ZNK6Simple4GetXEv | Decl,RelChild | rel: 1 + // CHECK-NEXT: RelChild | Simple | [[Simple_USR]] + + void PutX(int i); + // CHECK: [[@LINE-1]]:8 | instance-method/C++ | PutX | [[PutX_USR:.*]] | __ZN6Simple4PutXEi | Decl,RelChild | rel: 1 + // CHECK-NEXT: RelChild | Simple | [[Simple_USR]] + + __declspec(property(get=GetX, put=PutX)) int propX; + // CHECK: [[@LINE-1]]:48 | instance-property/C++ | propX | [[propX_USR:.*]] | <no-cgname> | Def,RelChild | rel: 1 + // CHECK-NEXT: RelChild | Simple | [[Simple_USR]] +}; + +// CHECK: [[@LINE+1]]:5 | function/C | test | [[test_USR:.*]] | __Z4testv | Def | rel: 0 +int test() { + Simple s; + s.propX = 5; + // CHECK: [[@LINE-1]]:5 | instance-property/C++ | propX | [[propX_USR]] | <no-cgname> | Ref,RelCont | rel: 1 + // CHECK-NEXT: RelCont | test | [[test_USR]] + // CHECK: [[@LINE-3]]:5 | instance-method/C++ | PutX | [[PutX_USR]] | __ZN6Simple4PutXEi | Ref,Call,RelCall,RelCont | rel: 1 + // CHECK-NEXT: RelCall,RelCont | test | [[test_USR]] + + return s.propX; + // CHECK: [[@LINE-1]]:12 | instance-property/C++ | propX | [[propX_USR]] | <no-cgname> | Ref,RelCont | rel: 1 + // CHECK-NEXT: RelCont | test | [[test_USR]] + // CHECK: [[@LINE-3]]:12 | instance-method/C++ | GetX | [[GetX_USR]] | __ZNK6Simple4GetXEv | Ref,Call,RelCall,RelCont | rel: 1 + // CHECK-NEXT: RelCall,RelCont | test | [[test_USR]] +} diff --git a/test/Index/opencl-types.cl b/test/Index/opencl-types.cl index 9eb680843a..e132c9d05a 100644 --- a/test/Index/opencl-types.cl +++ b/test/Index/opencl-types.cl @@ -17,11 +17,11 @@ void kernel testFloatTypes() { } // CHECK: VarDecl=scalarHalf:11:8 (Definition){{( \(invalid\))?}} [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=vectorHalf:12:9 (Definition) [type=half4] [typekind=Typedef] [canonicaltype=half __attribute__((ext_vector_type(4)))] [canonicaltypekind=ExtVector] [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=vectorFloat:14:10 (Definition) [type=float4] [typekind=Typedef] [canonicaltype=float __attribute__((ext_vector_type(4)))] [canonicaltypekind=ExtVector] [isPOD=1] // CHECK: VarDecl=scalarDouble:15:10 (Definition){{( \(invalid\))?}} [type=double] [typekind=Double] [isPOD=1] -// CHECK: VarDecl=vectorDouble:16:11 (Definition){{( \(invalid\))?}} [type=double4] [typekind=Typedef] [canonicaltype=double __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] +// CHECK: VarDecl=vectorDouble:16:11 (Definition){{( \(invalid\))?}} [type=double4] [typekind=Typedef] [canonicaltype=double __attribute__((ext_vector_type(4)))] [canonicaltypekind=ExtVector] [isPOD=1] #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable diff --git a/test/Index/pch-from-libclang.c b/test/Index/pch-from-libclang.c index 349fcac01e..f4dd0f046f 100644 --- a/test/Index/pch-from-libclang.c +++ b/test/Index/pch-from-libclang.c @@ -1,7 +1,11 @@ // 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 +// This test doesn't use -fdisable-module-hash and hence requires that +// CompilerInvocation::getModuleHash() computes exactly the same hash +// for c-index-test and clang, which in turn requires that the both use +// exactly the same resource-dir, even without calling realpath() on it: +// - a/../b/ and b/ are not considered the same +// - on Windows, c:\ and C:\ (only different in case) are not the same // 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 @@ -9,6 +13,9 @@ // 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 +// FIXME: Still fails on at least some linux boxen. +// REQUIRES: system-darwin + #ifndef HEADER #define HEADER diff --git a/test/Index/print-display-names.cpp b/test/Index/print-display-names.cpp index 5ba10e43bc..958948df53 100644 --- a/test/Index/print-display-names.cpp +++ b/test/Index/print-display-names.cpp @@ -20,7 +20,7 @@ template<> void g<int>(ClassTmpl<int, int>); // DISPLAY_NAME: print-display-names.cpp:13:17: FunctionDecl=g<>(ClassTmpl<int, int>):13:17 [Specialization of g:11:6] // RUN: env CINDEXTEST_PRINTINGPOLICY_TERSEOUTPUT=1 c-index-test -test-load-source all-pretty %s | FileCheck %s --check-prefix=PRETTY -// PRETTY: print-display-names.cpp:2:7: ClassTemplate=template <typename T, typename > class ClassTmpl {}:2:7 (Definition) Extent=[1:1 - 2:20] +// PRETTY: print-display-names.cpp:2:7: ClassTemplate=template <typename T, typename> class ClassTmpl {}:2:7 (Definition) Extent=[1:1 - 2:20] // PRETTY: print-display-names.cpp:4:13: TypedefDecl=typedef int Integer:4:13 (Definition) Extent=[4:1 - 4:20] // PRETTY: print-display-names.cpp:6:16: ClassDecl=template<> class ClassTmpl<int, int> {}:6:16 (Definition) [Specialization of ClassTmpl:2:7] Extent=[6:1 - 6:43] // PRETTY: print-display-names.cpp:8:6: FunctionDecl=void f(ClassTmpl<float, Integer> p):8:6 Extent=[8:1 - 8:36] diff --git a/test/Index/print-type-size.cpp b/test/Index/print-type-size.cpp index 1ea5346273..b4098d9772 100644 --- a/test/Index/print-type-size.cpp +++ b/test/Index/print-type-size.cpp @@ -400,4 +400,10 @@ plopplop; struct lastValid { }; +// CHECK64: CXXMethod=Tie:[[@LINE+3]]:8 (const) [type=auto (void *) const] [typekind=FunctionProto] [sizeof=1] [alignof=4] [resulttype=auto] [resulttypekind=Auto] [resultsizeof=-6] [resultalignof=-6] +// CHECK32: CXXMethod=Tie:[[@LINE+2]]:8 (const) [type=auto (void *) const] [typekind=FunctionProto] [sizeof=1] [alignof=4] [resulttype=auto] [resulttypekind=Auto] [resultsizeof=-6] [resultalignof=-6] +class BrowsingContext { + auto Tie(void*) const; +}; + } diff --git a/test/Index/print-type.c b/test/Index/print-type.c index 13c7655437..9bf0588408 100644 --- a/test/Index/print-type.c +++ b/test/Index/print-type.c @@ -15,6 +15,20 @@ int f2(int incompletearray[]); enum Enum{i}; enum Enum elaboratedEnumType(); struct Struct{}; struct Struct elaboratedStructType(); +struct { + int x; + int y; +} foo; + +struct { + struct { + int x; + int y; + }; +} bar; + +void fun(struct { int x; int y; } *param); + // RUN: c-index-test -test-print-type %s | FileCheck %s // CHECK: FunctionDecl=f:3:6 (Definition) [type=int *(int *, char *, FooType, int *, void (*)(int))] [typekind=FunctionProto] [canonicaltype=int *(int *, char *, int, int *, void (*)(int))] [canonicaltypekind=FunctionProto] [resulttype=int *] [resulttypekind=Pointer] [args= [int *] [Pointer] [char *] [Pointer] [FooType] [Typedef] [int [5]] [ConstantArray] [void (*)(int)] [Pointer]] [isPOD=0] // CHECK: ParmDecl=p:3:13 (Definition) [type=int *] [typekind=Pointer] [isPOD=1] [pointeetype=int] [pointeekind=Int] @@ -53,3 +67,7 @@ struct Struct{}; struct Struct elaboratedStructType(); // CHECK: StructDecl=Struct:16:8 (Definition) [type=struct Struct] [typekind=Record] [isPOD=1] // CHECK: FunctionDecl=elaboratedStructType:16:32 [type=struct Struct ()] [typekind=FunctionNoProto] [canonicaltype=struct Struct ()] [canonicaltypekind=FunctionNoProto] [resulttype=struct Struct] [resulttypekind=Elaborated] [isPOD=0] // CHECK: TypeRef=struct Struct:16:8 [type=struct Struct] [typekind=Record] [isPOD=1] +// CHECK: StructDecl=:18:1 (Definition) [type=struct (anonymous at {{.*}}print-type.c:18:1)] [typekind=Record] [isPOD=1] [nbFields=2] [isAnon=1] [isAnonRecDecl=0] +// CHECK: StructDecl=:23:1 (Definition) [type=struct (anonymous at {{.*}}print-type.c:23:1)] [typekind=Record] [isPOD=1] [nbFields=1] [isAnon=1] [isAnonRecDecl=0] +// CHECK: StructDecl=:24:3 (Definition) [type=struct (anonymous at {{.*}}print-type.c:24:3)] [typekind=Record] [isPOD=1] [nbFields=2] [isAnon=1] [isAnonRecDecl=1] +// CHECK: StructDecl=:30:10 (Definition) [type=struct (anonymous at {{.*}}print-type.c:30:10)] [typekind=Record] [isPOD=1] [nbFields=2] [isAnon=1] [isAnonRecDecl=0] diff --git a/test/Index/print-type.m b/test/Index/print-type.m index 2afdfc0ff8..26389b2527 100644 --- a/test/Index/print-type.m +++ b/test/Index/print-type.m @@ -19,6 +19,6 @@ // CHECK: ObjCInstanceMethodDecl=methodIn:andOut::5:10 (variadic) [Bycopy,] [type=] [typekind=Invalid] [resulttype=id] [resulttypekind=ObjCId] [args= [int] [Int] [short *] [Pointer]] [isPOD=0] // CHECK: ParmDecl=i:5:27 (Definition) [In,] [type=int] [typekind=Int] [isPOD=1] // CHECK: ParmDecl=j:5:49 (Definition) [Out,] [type=short *] [typekind=Pointer] [isPOD=1] [pointeetype=short] [pointeekind=Short] -// CHECK: ParmDecl=p:6:36 (Definition) [type=__kindof Foo *] [typekind=ObjCObjectPointer] [canonicaltype=__kindof Foo *] [canonicaltypekind=ObjCObjectPointer] [basetype=Foo] [basekind=ObjCInterface] [isPOD=1] [pointeetype=Foo] [pointeekind=ObjCInterface] +// CHECK: ParmDecl=p:6:36 (Definition) [type=__kindof Foo *] [typekind=ObjCObjectPointer] [canonicaltype=__kindof Foo *] [canonicaltypekind=ObjCObjectPointer] [basetype=Foo] [basekind=ObjCInterface] [isPOD=1] [pointeetype=__kindof Foo] [pointeekind=ObjCObject] // CHECK: ObjCPropertyDecl=classProp:7:23 [class,] [type=int] [typekind=Int] [isPOD=1] // CHECK: ObjCInstanceMethodDecl=generic:11:12 [type=] [typekind=Invalid] [resulttype=SomeType] [resulttypekind=ObjCTypeParam] [isPOD=0] diff --git a/test/Index/usrs.cpp b/test/Index/usrs.cpp index 2bd5744371..dbfa44f4b6 100644 --- a/test/Index/usrs.cpp +++ b/test/Index/usrs.cpp @@ -158,7 +158,7 @@ __m128 vectorOverload(__m128 f); // CHECK: usrs.cpp c:@NA@foo_alias // CHECK-NOT: foo // CHECK: usrs.cpp c:@NA@foo_alias2 -// CHECK-NOT: ClsB +// CHECK: usrs.cpp c:@UD@ClsB Extent=[64:1 - 64:16] // CHECK: usrs.cpp c:@NA@foo_alias3 // CHECK: usrs.cpp c:@aN Extent=[68:1 - 73:2] // CHECK: usrs.cpp c:usrs.cpp@aN@S@RDar9371763_Foo Extent=[69:1 - 72:2] |