diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
commit | 45b533945f0851ec234ca846e1af5ee1e4df0b6e (patch) | |
tree | 0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /test/Index | |
parent | 7e86edd64bfae4e324224452e4ea879b3371a4bd (diff) |
Notes
Diffstat (limited to 'test/Index')
41 files changed, 395 insertions, 39 deletions
diff --git a/test/Index/TestClassForwardDecl.m b/test/Index/TestClassForwardDecl.m index 284406f6446f8..4f8d8ff0ae01e 100644 --- a/test/Index/TestClassForwardDecl.m +++ b/test/Index/TestClassForwardDecl.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -emit-pch -x objective-c %s -o %t.ast +// RUN: c-index-test -write-pch %t.ast -arch x86_64 -mmacosx-version-min=10.6 %s // RUN: c-index-test -test-file-scan %t.ast %s | FileCheck -check-prefix=CHECK-scan %s // RUN: c-index-test -test-load-tu %t.ast local | FileCheck -check-prefix=CHECK-load %s // REQUIRES: x86-registered-target diff --git a/test/Index/annotate-comments-objc.m b/test/Index/annotate-comments-objc.m index a8eaa0b038807..471bc2bcb2176 100644 --- a/test/Index/annotate-comments-objc.m +++ b/test/Index/annotate-comments-objc.m @@ -69,6 +69,7 @@ typedef struct Struct_notdoxy *typedef_isdoxy1; // RUN: %clang_cc1 -emit-pch -o %t/out.pch -F %S/Inputs/Frameworks %s // RUN: %clang_cc1 -include-pch %t/out.pch -F %S/Inputs/Frameworks -fsyntax-only %s +// RUN: c-index-test -write-pch %t/out.pch -F %S/Inputs/Frameworks %s // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s -F %S/Inputs/Frameworks > %t/out.c-index-direct // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s -F %S/Inputs/Frameworks -fmodules -fmodules-cache-path=%t/module-cache > %t/out.c-index-modules // RUN: c-index-test -test-load-tu %t/out.pch all -F %S/Inputs/Frameworks > %t/out.c-index-pch diff --git a/test/Index/annotate-comments.cpp b/test/Index/annotate-comments.cpp index 6612a44792e68..6f9f8f0bbbc9e 100644 --- a/test/Index/annotate-comments.cpp +++ b/test/Index/annotate-comments.cpp @@ -263,6 +263,7 @@ void isdoxy54(int); // RUN: %clang_cc1 -x c++ -std=c++11 -emit-pch -o %t/out.pch %s // RUN: %clang_cc1 -x c++ -std=c++11 -include-pch %t/out.pch -fsyntax-only %s +// RUN: c-index-test -write-pch %t/out.pch -x c++ -std=c++11 %s // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s -std=c++11 > %t/out.c-index-direct // RUN: c-index-test -test-load-tu %t/out.pch all > %t/out.c-index-pch diff --git a/test/Index/annotate-module.m b/test/Index/annotate-module.m index 456a192f42537..24dce3f290bfe 100644 --- a/test/Index/annotate-module.m +++ b/test/Index/annotate-module.m @@ -6,6 +6,8 @@ int glob; // RUN: rm -rf %t.cache // RUN: c-index-test -test-annotate-tokens=%s:2:1:5:1 %s -fmodules-cache-path=%t.cache -fmodules -F %S/../Modules/Inputs \ // RUN: | FileCheck %s +// RUN: c-index-test -test-annotate-tokens=%s:2:1:5:1 %s -fmodules-cache-path=%t.cache -fmodules -gmodules -F %S/../Modules/Inputs \ +// RUN: | FileCheck %s // CHECK: Punctuation: "#" [2:1 - 2:2] inclusion directive=[[INC_DIR:DependsOnModule[/\\]DependsOnModule\.h \(.*/Modules/Inputs/DependsOnModule\.framework[/\\]Headers[/\\]DependsOnModule.h\)]] // CHECK-NEXT: Identifier: "include" [2:2 - 2:9] inclusion directive=[[INC_DIR]] diff --git a/test/Index/attributes-cuda.cu b/test/Index/attributes-cuda.cu index 51f4aedd198d0..83ac8d389fe6e 100644 --- a/test/Index/attributes-cuda.cu +++ b/test/Index/attributes-cuda.cu @@ -7,6 +7,14 @@ __attribute__((global)) void f_global(); __attribute__((constant)) int* g_constant; __attribute__((shared)) float *g_shared; __attribute__((host)) void f_host(); +__attribute__((device_builtin)) void f_device_builtin(); +typedef __attribute__((device_builtin)) const void *t_device_builtin; +enum __attribute__((device_builtin)) e_device_builtin {}; +__attribute__((device_builtin)) int v_device_builtin; +__attribute__((cudart_builtin)) void f_cudart_builtin(); +__attribute__((nv_weak)) void f_nv_weak(); +__attribute__((device_builtin_surface_type)) unsigned long long surface_var; +__attribute__((device_builtin_texture_type)) unsigned long long texture_var; // CHECK: attributes-cuda.cu:5:30: FunctionDecl=f_device:5:30 // CHECK-NEXT: attributes-cuda.cu:5:16: attribute(device) @@ -18,3 +26,11 @@ __attribute__((host)) void f_host(); // CHECK-NEXT: attributes-cuda.cu:8:16: attribute(shared) // CHECK: attributes-cuda.cu:9:28: FunctionDecl=f_host:9:28 // CHECK-NEXT: attributes-cuda.cu:9:16: attribute(host) +// CHECK: attributes-cuda.cu:10:38: FunctionDecl=f_device_builtin:10:38 +// CHECK: attributes-cuda.cu:11:53: TypedefDecl=t_device_builtin:11:53 +// CHECK: attributes-cuda.cu:12:38: EnumDecl=e_device_builtin:12:38 +// CHECK: attributes-cuda.cu:13:37: VarDecl=v_device_builtin:13:37 +// CHECK: attributes-cuda.cu:14:38: FunctionDecl=f_cudart_builtin:14:38 +// CHECK: attributes-cuda.cu:15:31: FunctionDecl=f_nv_weak:15:31 +// CHECK: attributes-cuda.cu:16:65: VarDecl=surface_var:16:65 +// CHECK: attributes-cuda.cu:17:65: VarDecl=texture_var:17:65 diff --git a/test/Index/availability.cpp b/test/Index/availability.cpp new file mode 100644 index 0000000000000..d6f90385f0bc8 --- /dev/null +++ b/test/Index/availability.cpp @@ -0,0 +1,13 @@ +void foo() = delete; + +struct Foo { + int foo() = delete; + Foo() = delete; +}; + + +// RUN: c-index-test -test-print-type --std=c++11 %s | FileCheck %s +// CHECK: FunctionDecl=foo:1:6 (unavailable) [type=void ()] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [isPOD=0] +// CHECK: StructDecl=Foo:3:8 (Definition) [type=Foo] [typekind=Record] [isPOD=1] +// CHECK: CXXMethod=foo:4:7 (unavailable) [type=int (){{.*}}] [typekind=FunctionProto] [resulttype=int] [resulttypekind=Int] [isPOD=0] +// CHECK: CXXConstructor=Foo:5:3 (unavailable) [type=void (){{.*}}] [typekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [isPOD=0] diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m index cbd742b240b56..29c37397673a8 100644 --- a/test/Index/c-index-api-loadTU-test.m +++ b/test/Index/c-index-api-loadTU-test.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -emit-pch -x objective-c %s -o %t.ast +// RUN: c-index-test -write-pch %t.ast -arch x86_64 -mmacosx-version-min=10.6 -fblocks -x objective-c %s // RUN: c-index-test -test-load-tu %t.ast all > %t 2>&1 && FileCheck --input-file=%t %s // REQUIRES: x86-registered-target @interface Foo diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m index f368f1f074337..2361af62ab70c 100644 --- a/test/Index/c-index-getCursor-test.m +++ b/test/Index/c-index-getCursor-test.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -emit-pch -x objective-c %s -detailed-preprocessing-record -o %t.ast +// RUN: c-index-test -write-pch %t.ast -arch x86_64 -mmacosx-version-min=10.6 -fblocks -x objective-c %s // RUN: c-index-test -test-file-scan %t.ast %s > %t 2>&1 && FileCheck --input-file=%t %s @interface Foo { diff --git a/test/Index/c-index-pch.c b/test/Index/c-index-pch.c index 313fae88f4f94..4a035d7ad8f91 100644 --- a/test/Index/c-index-pch.c +++ b/test/Index/c-index-pch.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -emit-pch -x c -o %t.pch %S/Inputs/c-index-pch.h -// RUN: %clang_cc1 -include-pch %t.pch -x c -emit-pch -o %t.ast %s +// RUN: c-index-test -write-pch %t.pch -x c %S/Inputs/c-index-pch.h +// RUN: c-index-test -write-pch %t.ast -Xclang -include-pch -Xclang %t.pch -x c %s // RUN: c-index-test -test-load-tu %t.ast all | FileCheck -check-prefix=ALL %s // ALL: FunctionDecl=foo // ALL: VarDecl=bar diff --git a/test/Index/c-index-redecls.c b/test/Index/c-index-redecls.c index 0cf2f032a3c7a..67e58684e8114 100644 --- a/test/Index/c-index-redecls.c +++ b/test/Index/c-index-redecls.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-pch -o %t.ast %s +// RUN: c-index-test -write-pch %t.ast %s // RUN: c-index-test -test-load-tu %t.ast all // rdar://8956193 - We would blow the thread stack because of nested calls due diff --git a/test/Index/cindex-from-source.m b/test/Index/cindex-from-source.m index 504d90fd2bc9e..5ea8504d673e7 100644 --- a/test/Index/cindex-from-source.m +++ b/test/Index/cindex-from-source.m @@ -1,5 +1,5 @@ // REQUIRES: native -// RUN: %clang -x objective-c-header %S/Inputs/cindex-from-source.h -o %t.pfx.h.gch +// RUN: c-index-test -write-pch %t.pfx.h.gch -x objective-c-header %S/Inputs/cindex-from-source.h // RUN: c-index-test -test-load-source local %s -include %t.pfx.h > %t // RUN: FileCheck %s < %t // CHECK: cindex-from-source.m:{{.*}}:{{.*}}: StructDecl=s0:{{.*}}:{{.*}} diff --git a/test/Index/comment-custom-block-command.cpp b/test/Index/comment-custom-block-command.cpp index f87cef96e5902..bb153dc878042 100644 --- a/test/Index/comment-custom-block-command.cpp +++ b/test/Index/comment-custom-block-command.cpp @@ -5,6 +5,7 @@ // RUN: %clang_cc1 -fcomment-block-commands=CustomCommand -x c++ -std=c++11 -emit-pch -o %t/out.pch %s // RUN: %clang_cc1 -x c++ -std=c++11 -fcomment-block-commands=CustomCommand -include-pch %t/out.pch -fsyntax-only %s +// RUN: c-index-test -write-pch %t/out.pch -fcomment-block-commands=CustomCommand -x c++ -std=c++11 %s // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s -std=c++11 -fcomment-block-commands=CustomCommand > %t/out.c-index-direct // RUN: c-index-test -test-load-tu %t/out.pch all > %t/out.c-index-pch diff --git a/test/Index/comment-objc-parameterized-classes.m b/test/Index/comment-objc-parameterized-classes.m index 5a928509dfe6d..8ee5c6bd64874 100644 --- a/test/Index/comment-objc-parameterized-classes.m +++ b/test/Index/comment-objc-parameterized-classes.m @@ -17,3 +17,8 @@ /// A @interface A<__covariant T : id, U : NSObject *> : NSObject @end + +// CHECK: <Declaration>@interface AA : A <id, NSObject *> +/// AA +@interface AA : A<id, NSObject *> +@end diff --git a/test/Index/comment-to-html-xml-conversion.cpp b/test/Index/comment-to-html-xml-conversion.cpp index f31061aa12ab1..6c10efedeaf0a 100644 --- a/test/Index/comment-to-html-xml-conversion.cpp +++ b/test/Index/comment-to-html-xml-conversion.cpp @@ -7,6 +7,7 @@ // RUN: %clang_cc1 -x c++ -std=c++11 -emit-pch -o %t/out.pch %s // RUN: %clang_cc1 -x c++ -std=c++11 -include-pch %t/out.pch -fsyntax-only %s +// RUN: c-index-test -write-pch %t/out.pch -x c++ -std=c++11 %s // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s -std=c++11 > %t/out.c-index-direct // RUN: c-index-test -test-load-tu %t/out.pch all > %t/out.c-index-pch @@ -799,7 +800,7 @@ class comment_to_xml_conversion_01 { template<typename T> using comment_to_xml_conversion_09 = comment_to_xml_conversion_08<T, int>; -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:3: UnexposedDecl=comment_to_xml_conversion_09:{{.*}} FullCommentAsXML=[<Typedef file="{{[^"]+}}comment-to-html-xml-conversion.cpp" line="[[@LINE-2]]" column="3"><Name>comment_to_xml_conversion_09</Name><USR>c:@S@comment_to_xml_conversion_01@comment_to_xml_conversion_09</USR><Declaration>template <typename T>\nusing comment_to_xml_conversion_09 = comment_to_xml_conversion_08<T, int></Declaration><Abstract><Para> Aaa.</Para></Abstract></Typedef>] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:3: TypeAliasTemplateDecl=comment_to_xml_conversion_09:{{.*}} FullCommentAsXML=[<Typedef file="{{[^"]+}}comment-to-html-xml-conversion.cpp" line="[[@LINE-2]]" column="3"><Name>comment_to_xml_conversion_09</Name><USR>c:@S@comment_to_xml_conversion_01@comment_to_xml_conversion_09</USR><Declaration>template <typename T>\nusing comment_to_xml_conversion_09 = comment_to_xml_conversion_08<T, int></Declaration><Abstract><Para> Aaa.</Para></Abstract></Typedef>] }; /// Aaa. diff --git a/test/Index/complete-kvc.m b/test/Index/complete-kvc.m index 62d98a9b2077a..336d41d759a17 100644 --- a/test/Index/complete-kvc.m +++ b/test/Index/complete-kvc.m @@ -101,5 +101,5 @@ typedef signed char BOOL; // RUN: c-index-test -code-completion-at=%s:52:8 %s | FileCheck -check-prefix=CHECK-CC3 %s // CHECK-CC3: ObjCInstanceMethodDecl:{TypedText countOfIntProperty} (55) -// CHECK-CC3-NEXT: ObjCInstanceMethodDecl:{TypedText intProperty} (40) +// CHECK-CC3-NEXT: ObjCInstanceMethodDecl:{TypedText intProperty} (42) // CHECK-CC3-NEXT: ObjCInstanceMethodDecl:{TypedText isIntProperty} (40) diff --git a/test/Index/complete-method-decls.m b/test/Index/complete-method-decls.m index e45d68f970874..41134081e1553 100644 --- a/test/Index/complete-method-decls.m +++ b/test/Index/complete-method-decls.m @@ -87,6 +87,9 @@ typedef A *MyObjectRef; @interface I2 -(nonnull I2 *)produceI2:(nullable I2 *)i2; +-(int *__nullable *__nullable)something:(void(^__nullable)(int *__nullable))b; +@property (nullable, strong) id prop; +@property (nullable, strong) void(^propWB)(int *_Nullable); @end @implementation I2 @@ -222,9 +225,14 @@ typedef A *MyObjectRef; // CHECK-CLASSTY: ObjCInstanceMethodDecl:{LeftParen (}{Text MyObject<P1> *}{RightParen )}{TypedText meth2} // CHECK-CLASSTY: ObjCInstanceMethodDecl:{LeftParen (}{Text MyObjectRef}{RightParen )}{TypedText meth3} -// RUN: c-index-test -code-completion-at=%s:93:2 %s | FileCheck -check-prefix=CHECK-NULLABILITY %s -// CHECK-NULLABILITY: ObjCInstanceMethodDecl:{LeftParen (}{Text nonnull }{Text I2 *}{RightParen )}{TypedText produceI2}{TypedText :}{LeftParen (}{Text nullable }{Text I2 *}{RightParen )}{Text i2} (40) - -// RUN: c-index-test -code-completion-at=%s:104:2 %s | FileCheck -check-prefix=CHECK-NULLABILITY2 %s -// CHECK-NULLABILITY2: ObjCInstanceMethodDecl:{LeftParen (}{Text nonnull }{Text instancetype}{RightParen )}{TypedText getI3} (40) -// CHECK-NULLABILITY2: ObjCInstanceMethodDecl:{LeftParen (}{Text nonnull }{Text I3 *}{RightParen )}{TypedText produceI3}{TypedText :}{LeftParen (}{Text nonnull }{Text I3 *}{RightParen )}{Text i3} (40) +// RUN: c-index-test -code-completion-at=%s:96:2 %s -target x86_64-apple-macosx10.7 | FileCheck -check-prefix=CHECK-NULLABILITY %s +// CHECK-NULLABILITY: ObjCInstanceMethodDecl:{LeftParen (}{Text I2 *}{RightParen )}{TypedText produceI2}{TypedText :}{LeftParen (}{Text I2 *}{RightParen )}{Text i2} (40) +// CHECK-NULLABILITY: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText prop} +// CHECK-NULLABILITY: ObjCInstanceMethodDecl:{LeftParen (}{Text void (^)(int * _Nullable)}{RightParen )}{TypedText propWB} +// CHECK-NULLABILITY: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText setProp}{TypedText :}{LeftParen (}{Text id}{RightParen )}{Text prop} +// CHECK-NULLABILITY: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText setPropWB}{TypedText :}{LeftParen (}{Text void (^)(int * _Nullable)}{RightParen )}{Text propWB} +// CHECK-NULLABILITY: ObjCInstanceMethodDecl:{LeftParen (}{Text int * _Nullable *}{RightParen )}{TypedText something}{TypedText :}{LeftParen (}{Text void (^)(int * _Nullable)}{RightParen )}{Text b} + +// RUN: c-index-test -code-completion-at=%s:107:2 %s -target x86_64-apple-macosx10.7 | FileCheck -check-prefix=CHECK-NULLABILITY2 %s +// CHECK-NULLABILITY2: ObjCInstanceMethodDecl:{LeftParen (}{Text instancetype}{RightParen )}{TypedText getI3} (40) +// CHECK-NULLABILITY2: ObjCInstanceMethodDecl:{LeftParen (}{Text I3 *}{RightParen )}{TypedText produceI3}{TypedText :}{LeftParen (}{Text I3 *}{RightParen )}{Text i3} (40) diff --git a/test/Index/complete-modules.m b/test/Index/complete-modules.m index 175cf3db2c7fe..21f0e4bafe890 100644 --- a/test/Index/complete-modules.m +++ b/test/Index/complete-modules.m @@ -5,6 +5,7 @@ // RUN: rm -rf %t // RUN: c-index-test -code-completion-at=%s:4:9 -fmodules-cache-path=%t -fmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-TOP-LEVEL %s +// RUN: c-index-test -code-completion-at=%s:4:9 -fmodules-cache-path=%t -fmodules -gmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-TOP-LEVEL %s // CHECK-TOP-LEVEL: ModuleImport:{TypedText Framework} (50) // CHECK-TOP-LEVEL: ModuleImport:{TypedText LibA} (50) // CHECK-TOP-LEVEL: ModuleImport:{TypedText nested} (50) diff --git a/test/Index/complete-parameterized-classes.m b/test/Index/complete-parameterized-classes.m index 70d85885e3b7e..ffef991acbeec 100644 --- a/test/Index/complete-parameterized-classes.m +++ b/test/Index/complete-parameterized-classes.m @@ -65,7 +65,7 @@ void test3() { // CHECK-CC5: ObjCIvarDecl:{ResultType __kindof NSObject *}{TypedText myVar} (35) // RUN: c-index-test -code-completion-at=%s:37:2 %s | FileCheck -check-prefix=CHECK-CC6 %s -// CHECK-CC6: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText apply2}{TypedText :}{LeftParen (}{Text void (^ _Nonnull)(id, NSObject *)}{RightParen )}{Text block} (40) +// CHECK-CC6: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText apply2}{TypedText :}{LeftParen (}{Text void (^)(id, NSObject *)}{RightParen )}{Text block} (40) // CHECK-CC6: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText apply}{TypedText :}{LeftParen (}{Text void (^)(id, NSObject *)}{RightParen )}{Text block} (40) // CHECK-CC6: ObjCInstanceMethodDecl:{LeftParen (}{Text NSObject *}{RightParen )}{TypedText getit}{TypedText :}{LeftParen (}{Text id}{RightParen )}{Text val} (40) // CHECK-CC6: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText prop} (40) diff --git a/test/Index/complete-pch.m b/test/Index/complete-pch.m index 4c29f2796b5c7..486a0dc53d044 100644 --- a/test/Index/complete-pch.m +++ b/test/Index/complete-pch.m @@ -14,7 +14,7 @@ void msg_id(id x) { // REQUIRES: native // Build the precompiled header -// RUN: %clang -x objective-c-header -o %t.h.pch %S/Inputs/complete-pch.h +// RUN: c-index-test -write-pch %t.h.pch -x objective-c-header %S/Inputs/complete-pch.h // Run the actual tests // RUN: c-index-test -code-completion-at=%s:10:7 -include %t.h %s | FileCheck -check-prefix=CHECK-CC1 %s diff --git a/test/Index/complete-preamble.cpp b/test/Index/complete-preamble.cpp index c57c88ab330aa..15720f9a297f8 100644 --- a/test/Index/complete-preamble.cpp +++ b/test/Index/complete-preamble.cpp @@ -3,6 +3,15 @@ void f() { std:: } -// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:3:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s -// CHECK-CC1: {ResultType void}{TypedText wibble}{LeftParen (}{RightParen )} (50) +// RUN: env CINDEXTEST_EDITING=1 LIBCLANG_TIMING=1 c-index-test -code-completion-at=%s:3:8 %s -o - 2>&1 | FileCheck -check-prefix=CHECK-CC1 -check-prefix=SECOND %s +// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_CREATE_PREAMBLE_ON_FIRST_PARSE=1 LIBCLANG_TIMING=1 c-index-test -code-completion-at=%s:3:8 %s -o - 2>&1 | FileCheck -check-prefix=CHECK-CC1 -check-prefix=FIRST %s + +// FIRST: Precompiling preamble +// FIRST: Parsing +// FIRST: Reparsing +// SECOND: Parsing +// SECOND: Precompiling preamble +// SECOND: Reparsing + +// CHECK-CC1: {ResultType void}{TypedText wibble}{LeftParen (}{RightParen )} (50) diff --git a/test/Index/complete-property-flags.m b/test/Index/complete-property-flags.m index 9e3fc1aff319d..8e357678fd373 100644 --- a/test/Index/complete-property-flags.m +++ b/test/Index/complete-property-flags.m @@ -7,7 +7,8 @@ @property(copy) Foo *myprop; @property(retain, nonatomic) id xx; -// RUN: c-index-test -code-completion-at=%s:7:11 %s -fno-objc-arc | FileCheck -check-prefix=CHECK-CC1 %s +// RUN: c-index-test -code-completion-at=%s:7:11 %s -fobjc-runtime=macosx-10.4 -fno-objc-arc | FileCheck -check-prefix=CHECK-CC1 -check-prefix=CHECK-CC1-NOWEAK %s +// RUN: c-index-test -code-completion-at=%s:7:11 %s -fobjc-runtime=macosx-10.8 -Xclang -fobjc-weak -fno-objc-arc | FileCheck -check-prefix=CHECK-CC1 -check-prefix=CHECK-CC1-WEAK %s // CHECK-CC1: {TypedText assign} // CHECK-CC1-NEXT: {TypedText atomic} // CHECK-CC1-NEXT: {TypedText copy} @@ -23,7 +24,8 @@ // CHECK-CC1-NEXT: {TypedText setter}{Text =}{Placeholder method} // CHECK-CC1-NEXT: {TypedText strong} // CHECK-CC1-NEXT: {TypedText unsafe_unretained} -// CHECK-CC1-NOT: {TypedText weak} +// CHECK-CC1-NOWEAK-NOT: {TypedText weak} +// CHECK-CC1-WEAK-NEXT: {TypedText weak} // RUN: c-index-test -code-completion-at=%s:7:11 %s -fobjc-arc -fobjc-runtime=macosx-10.7 | FileCheck -check-prefix=CHECK-CC1-ARC %s // CHECK-CC1-ARC: {TypedText assign} diff --git a/test/Index/crash-recovery-modules.m b/test/Index/crash-recovery-modules.m index 431c23f7dcadb..3e7e8059aaaad 100644 --- a/test/Index/crash-recovery-modules.m +++ b/test/Index/crash-recovery-modules.m @@ -2,13 +2,13 @@ // RUN: rm -rf %t // Parse the file, such that building the module will cause Clang to crash. -// RUN: not env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all -fmodules -fmodules-cache-path=%t -Xclang -fdisable-module-hash -I %S/Inputs/Headers -DCRASH %s 2> %t.err +// 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' // Parse the file again, without crashing, to make sure that // subsequent parses do the right thing. -// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all -fmodules -fmodules-cache-path=%t -Xclang -fdisable-module-hash -I %S/Inputs/Headers %s +// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all -fmodules -fmodules-cache-path=%t -Xclang -fdisable-module-hash -I %S/Inputs/Headers %s > /dev/null // REQUIRES: crash-recovery // REQUIRES: shell @@ -26,10 +26,10 @@ void test() { // RUN: rm -rf %t // Check that libclang crash-recovery works; both with a module building 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 -DLIBCLANG_CRASH %s 2> %t.err +// 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 -DLIBCLANG_CRASH %s > /dev/null 2> %t.err // RUN: FileCheck < %t.err -check-prefix=CHECK-LIBCLANG-CRASH %s // ...and with module building successful. -// 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 -DLIBCLANG_CRASH %s 2> %t.err +// 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 -DLIBCLANG_CRASH %s > /dev/null 2> %t.err // RUN: FileCheck < %t.err -check-prefix=CHECK-LIBCLANG-CRASH %s // CHECK-LIBCLANG-CRASH: libclang: crash detected during parsing // CHECK-LIBCLANG-CRASH: Unable to load translation unit! diff --git a/test/Index/fix-its.m b/test/Index/fix-its.m index fabcdb2905f66..65aa81dc86638 100644 --- a/test/Index/fix-its.m +++ b/test/Index/fix-its.m @@ -20,7 +20,3 @@ void _rdar_12584554_A (volatile const void * object, volatile const void * selec @end // CHECK: FIX-IT: Insert "@" at 18:22 -// CHECK: fix-its.m:9:28: note: expanded from macro '_rdar_12584554_C' -// CHECK: Number FIX-ITs = 0 -// CHECK: fix-its.m:7:77: note: expanded from macro '_rdar_12584554_B' -// CHECK: Number FIX-ITs = 0 diff --git a/test/Index/get-cursor.m b/test/Index/get-cursor.m index f659fb1ff61cd..d321233401c8e 100644 --- a/test/Index/get-cursor.m +++ b/test/Index/get-cursor.m @@ -112,6 +112,23 @@ void foo3(Test3 *test3) { @property (retain) id propProp3; @end +@interface TestNullability +@property (strong, nonnull) id prop1; +@property (strong, nullable) id prop2; +@end + +@implementation TestNullability +- (void)meth { + TestNullability *o; + [o.prop1 meth]; + [o.prop2 meth]; + _Nullable id lo1; + _Nonnull id lo2; + [lo1 meth]; + [lo2 meth]; +} +@end + // 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 @@ -170,3 +187,9 @@ void foo3(Test3 *test3) { // CHECK-OBJCOPTIONAL: 108:23 ObjCPropertyDecl=propProp2:108:23 (@optional) [retain,] Extent=[108:1 - 108:32] // CHECK-OBJCOPTIONAL: 111:8 ObjCInstanceMethodDecl=protMeth3:111:8 Extent=[111:1 - 111:18] // CHECK-OBJCOPTIONAL: 112:23 ObjCPropertyDecl=propProp3:112:23 [retain,] Extent=[112:1 - 112:32] + +// RUN: c-index-test -cursor-at=%s:123:12 %s | FileCheck -check-prefix=CHECK-RECEIVER-WITH-NULLABILITY %s +// RUN: c-index-test -cursor-at=%s:124:12 %s | FileCheck -check-prefix=CHECK-RECEIVER-WITH-NULLABILITY %s +// 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 diff --git a/test/Index/index-attrs.c b/test/Index/index-attrs.c new file mode 100644 index 0000000000000..d526721f5b203 --- /dev/null +++ b/test/Index/index-attrs.c @@ -0,0 +1,16 @@ +// RUN: c-index-test -index-file -check-prefix CHECK %s -target armv7-windows-gnu -fdeclspec + +void __declspec(dllexport) export_function(void) {} +// CHECK: [indexDeclaraton]: kind: function | name: export_function | {{.*}} | lang: C +// CHECK: <attribute>: attribute(dllexport) +void __attribute__((dllexport)) export_gnu_attribute(void) {} +// CHECK: [indexDeclaration] kind: function | name: export_gnu_attribute | {{.*}} | lang: C +// CHECK: <attribute>: attribute(dllexport) + +void __declspec(dllimport) import_function(void); +// CHECK: [indexDeclaration] kind: function | name: import_function | {{.*}} | lang: C +// CHECK: <attribute>: attribute(dllimport) +void __attribute__((dllimport)) import_gnu_attribute(void); +// CHECK: [indexDeclaration] kind: function | name: import_gnu_function | {{.*}} | lang: C +// CHECK: <attribute>: attribute(dllimport) + diff --git a/test/Index/index-attrs.cpp b/test/Index/index-attrs.cpp new file mode 100644 index 0000000000000..b6100acf880a4 --- /dev/null +++ b/test/Index/index-attrs.cpp @@ -0,0 +1,50 @@ +// RUN: c-index-test -index-file -check-prefix CHECK %s -target armv7-windows-gnu -fdeclspec + +struct __declspec(dllexport) export_s { + void m(); +}; +// CHECK: [indexDeclaration]: kind: struct | name: export_s | {{.*}} | lang: C++ +// CHECK: <attribute>: attribute(dllexport) +// CHECK: [indexDeclaration]: kind: c++-instance-method | name: m | {{.*}} | lang: C++ +// CHECK: <attribute>: attribute(dllexport) + +struct __declspec(dllimport) import_s { + void m(); +}; +// CHECK: [indexDeclaration]: kind: struct | name: import_s | {{.*}} | lang: C++ +// CHECK: <attribute>: attribute(dllimport) +// CHECK: [indexDeclaration]: kind: c++-instance-method | name: m | {{.*}} | lang: C++ +// CHECK: <attribute>: attribute(dllimport) + +class __attribute__((dllexport)) export_gnu_s { + void m(); +}; +// CHECK: [indexDeclaration]: kind: struct | name: export_gnu_s | {{.*}} | lang: C++ +// CHECK: <attribute>: attribute(dllexport) +// CHECK: [indexDeclaration]: kind: c++-instance-method | name: m | {{.*}} | lang: C++ +// CHECK: <attribute>: attribute(dllexport) + +class __attribute__((dllimport)) import_gnu_s { + void m(); +}; +// CHECK: [indexDeclaration]: kind: struct | name: import_gnu_s | {{.*}} | lang: C++ +// CHECK: <attribute>: attribute(dllimport) +// CHECK: [indexDeclaration]: kind: c++-instance-method | name: m | {{.*}} | lang: C++ +// CHECK: <attribute>: attribute(dllimport) + +extern "C" void __declspec(dllexport) export_function(void) {} +// CHECK: [indexDeclaraton]: kind: function | name: export_function | {{.*}} | lang: C +// CHECK: <attribute>: attribute(dllexport) +extern "C" void __attribute__((dllexport)) export_gnu_function(void) {} +// CHECK: [indexDeclaraton]: kind: function | name: export_gnu_function | {{.*}} | lang: C +// CHECK: <attribute>: attribute(dllexport) + +extern "C" { +void __declspec(dllimport) import_function(void); +// CHECK: [indexDeclaration] kind: function | name: import_function | {{.*}} | lang: C +// CHECK: <attribute>: attribute(dllimport) +void __attribute__((dllimport)) import_gnu_function(void); +// CHECK: [indexDeclaration] kind: function | name: import_gnu_function | {{.*}} | lang: C +// CHECK: <attribute>: attribute(dllimport) +} + diff --git a/test/Index/index-file.cpp b/test/Index/index-file.cpp index 37b14a2715a98..f1ae68a2508de 100644 --- a/test/Index/index-file.cpp +++ b/test/Index/index-file.cpp @@ -15,9 +15,25 @@ void tfoo() {} void tfoo<int>() {} } +namespace crash1 { +template<typename T> class A { + A(A &) = delete; + void meth(); +}; +template <> void A<int>::meth(); +template class A<int>; +} + +class B { + mutable int x_; + int y_; +}; // RUN: c-index-test -index-file %s > %t // RUN: FileCheck %s -input-file=%t // CHECK: [indexDeclaration]: kind: type-alias | name: MyTypeAlias | {{.*}} | loc: 1:7 // CHECK: [indexDeclaration]: kind: struct-template-spec | name: TS | {{.*}} | loc: 11:8 // CHECK: [indexDeclaration]: kind: function-template-spec | name: tfoo | {{.*}} | loc: 15:6 +// CHECK: [indexDeclaration]: kind: c++-instance-method | name: meth | {{.*}} | loc: 23:26 +// CHECK: [indexDeclaration]: kind: field | name: x_ | USR: c:@S@B@FI@x_ | lang: C++ | cursor: FieldDecl=x_:28:15 (Definition) (mutable) | loc: 28:15 | semantic-container: [B:27:7] | lexical-container: [B:27:7] | isRedecl: 0 | isDef: 1 | isContainer: 0 | isImplicit: 0 +// CHECK: [indexDeclaration]: kind: field | name: y_ | USR: c:@S@B@FI@y_ | lang: C++ | cursor: FieldDecl=y_:29:7 (Definition) | loc: 29:7 | semantic-container: [B:27:7] | lexical-container: [B:27:7] | isRedecl: 0 | isDef: 1 | isContainer: 0 | isImplicit: 0 diff --git a/test/Index/index-module.m b/test/Index/index-module.m index a973e91af8336..ff512592b6708 100644 --- a/test/Index/index-module.m +++ b/test/Index/index-module.m @@ -6,6 +6,8 @@ int glob; // RUN: rm -rf %t.cache // RUN: c-index-test -index-file %s -fmodules-cache-path=%t.cache -fmodules -F %S/../Modules/Inputs \ // RUN: -Xclang -fdisable-module-hash | FileCheck %s +// RUN: c-index-test -index-file %s -fmodules-cache-path=%t.cache -fmodules -gmodules -F %S/../Modules/Inputs \ +// RUN: -Xclang -fdisable-module-hash | FileCheck %s // CHECK-NOT: [indexDeclaration] // CHECK: [ppIncludedFile]: {{.*}}/Modules/Inputs/DependsOnModule.framework{{[/\\]}}Headers{{[/\\]}}DependsOnModule.h | name: "DependsOnModule/DependsOnModule.h" | hash loc: 2:1 | isImport: 0 | isAngled: 1 | isModule: 1 diff --git a/test/Index/index-pch-with-module.m b/test/Index/index-pch-with-module.m index 53bac1e446004..36c9c2beb475b 100644 --- a/test/Index/index-pch-with-module.m +++ b/test/Index/index-pch-with-module.m @@ -18,8 +18,8 @@ int glob; // CHECK-NOT: [indexDeclaration] // CHECK: [importedASTFile]: {{.*}}.h.pch -// CHECK-NEXT: [enteredMainFile]: {{.*[/\\]}}index-pch-with-module.m // CHECK-NEXT: [startedTranslationUnit] +// CHECK-NEXT: [enteredMainFile]: {{.*[/\\]}}index-pch-with-module.m // CHECK-NEXT: [indexDeclaration]: kind: variable | name: glob | {{.*}} | loc: 10:5 // CHECK-NOT: [indexDeclaration] diff --git a/test/Index/index-templates.cpp b/test/Index/index-templates.cpp index 570d7cf15d4da..79b9c181ecaf4 100644 --- a/test/Index/index-templates.cpp +++ b/test/Index/index-templates.cpp @@ -110,6 +110,9 @@ static const int FxnTmpl_Var = 7; template <> void foo<float, 9, FxnTmplEnum_B, FxnTmpl_Var + 7>(float Value); +template <class T> +using alias = T; + // RUN: c-index-test -test-load-source all -fno-delayed-template-parsing %s | FileCheck -check-prefix=CHECK-LOAD %s // CHECK-LOAD: index-templates.cpp:4:6: FunctionTemplate=f:4:6 Extent=[3:1 - 4:22] // CHECK-LOAD: index-templates.cpp:3:19: TemplateTypeParameter=T:3:19 (Definition) Extent=[3:10 - 3:20] @@ -189,6 +192,10 @@ void foo<float, 9, FxnTmplEnum_B, FxnTmpl_Var + 7>(float Value); // CHECK-LOAD: index-templates.cpp:101:20: C++ base class specifier=Pair<int, int>:98:16 [access=public isVirtual=false] Extent=[101:20 - 101:34] // CHECK-LOAD: index-templates.cpp:101:36: C++ base class specifier=Pair<T, U>:76:8 [access=public isVirtual=false] Extent=[101:36 - 101:46] // CHECK-LOAD: index-templates.cpp:111:6: FunctionDecl=foo:111:6 [Specialization of foo:107:6] [Template arg 0: kind: 1, type: float] [Template arg 1: kind: 4, intval: 9] [Template arg 2: kind: 4, intval: 1] [Template arg 3: kind: 4, intval: 14] Extent=[110:1 - 111:64] +// CHECK-LOAD: index-templates.cpp:114:1: TypeAliasTemplateDecl=alias:114:1 (Definition) Extent=[113:1 - 114:16] +// CHECK-LOAD: index-templates.cpp:113:17: TemplateTypeParameter=T:113:17 (Definition) Extent=[113:11 - 113:18] [access=public] +// CHECK-LOAD: index-templates.cpp:114:7: TypeAliasDecl=alias:114:7 (Definition) Extent=[114:1 - 114:16] +// CHECK-LOAD: index-templates.cpp:114:15: TypeRef=T:113:17 Extent=[114:15 - 114:16] // RUN: c-index-test -test-load-source-usrs all -fno-delayed-template-parsing %s | FileCheck -check-prefix=CHECK-USRS %s // CHECK-USRS: index-templates.cpp c:@FT@>3#T#Nt0.0#t>2#T#Nt1.0f#>t0.22S0_#v# Extent=[3:1 - 4:22] diff --git a/test/Index/namespaced-base-ctor-init.cpp b/test/Index/namespaced-base-ctor-init.cpp new file mode 100644 index 0000000000000..2d60f7c6530a4 --- /dev/null +++ b/test/Index/namespaced-base-ctor-init.cpp @@ -0,0 +1,10 @@ +namespace ns1 { +struct Base {}; +struct Derived : Base { + Derived() : ns1::Base() {} +}; +} + +// RUN: c-index-test -test-load-source all %s | FileCheck %s +// CHECK: namespaced-base-ctor-init.cpp:4:15: NamespaceRef=ns1:1:11 Extent=[4:15 - 4:18] +// CHECK: namespaced-base-ctor-init.cpp:4:20: TypeRef=struct ns1::Base:2:8 Extent=[4:20 - 4:24] diff --git a/test/Index/parse-all-comments.c b/test/Index/parse-all-comments.c index f8b0449f20020..66981e2b421be 100644 --- a/test/Index/parse-all-comments.c +++ b/test/Index/parse-all-comments.c @@ -33,12 +33,47 @@ void multi_line_comment_plus_ordinary(int); // WITH EMPTY LINE void multi_line_comment_empty_line(int); +int notdoxy7; // Not a Doxygen juxtaposed comment. notdoxy7 NOT_DOXYGEN +int notdoxy8; // Not a Doxygen juxtaposed comment. notdoxy8 NOT_DOXYGEN + +int trdoxy9; /// A Doxygen non-trailing comment. trdoxyA IS_DOXYGEN_SINGLE +int trdoxyA; + +int trdoxyB; // Not a Doxygen trailing comment. PART_ONE + // It's a multiline one too. trdoxyB NOT_DOXYGEN +int trdoxyC; + +int trdoxyD; // Not a Doxygen trailing comment. trdoxyD NOT_DOXYGEN + /// This comment doesn't get merged. trdoxyE IS_DOXYGEN +int trdoxyE; + +int trdoxyF; /// A Doxygen non-trailing comment that gets dropped on the floor. + // This comment will also be dropped. +int trdoxyG; // This one won't. trdoxyG NOT_DOXYGEN + +int trdoxyH; ///< A Doxygen trailing comment. PART_ONE + // This one gets merged with it. trdoxyH SOME_DOXYGEN +int trdoxyI; // This one doesn't. trdoxyI NOT_DOXYGEN + +int trdoxyJ; // Not a Doxygen trailing comment. PART_ONE + ///< This one gets merged with it. trdoxyJ SOME_DOXYGEN +int trdoxyK; // This one doesn't. trdoxyK NOT_DOXYGEN + +int trdoxyL; // Not a Doxygen trailing comment. trdoxyL NOT_DOXYGEN +// This one shouldn't get merged. trdoxyM NOT_DOXYGEN +int trdoxyM; + +int trdoxyN; ///< A Doxygen trailing comment. trdoxyN IS_DOXYGEN + // This one shouldn't get merged. trdoxyO NOT_DOXYGEN +int trdoxyO; + + #endif // RUN: rm -rf %t // RUN: mkdir %t -// RUN: %clang_cc1 -fparse-all-comments -x c++ -std=c++11 -emit-pch -o %t/out.pch %s +// RUN: c-index-test -write-pch %t/out.pch -fparse-all-comments -x c++ -std=c++11 %s // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s -std=c++11 -fparse-all-comments > %t/out.c-index-direct // RUN: c-index-test -test-load-tu %t/out.pch all > %t/out.c-index-pch @@ -60,3 +95,21 @@ void multi_line_comment_empty_line(int); // CHECK: parse-all-comments.c:22:6: FunctionDecl=isdoxy6:{{.*}} isdoxy6 IS_DOXYGEN_SINGLE // CHECK: parse-all-comments.c:29:6: FunctionDecl=multi_line_comment_plus_ordinary:{{.*}} BLOCK_ORDINARY_COMMENT {{.*}} ORDINARY COMMENT {{.*}} IS_DOXYGEN_START {{.*}} IS_DOXYGEN_END // CHECK: parse-all-comments.c:34:6: FunctionDecl=multi_line_comment_empty_line:{{.*}} MULTILINE COMMENT{{.*}}\n{{.*}}\n{{.*}} WITH EMPTY LINE +// CHECK: parse-all-comments.c:36:5: VarDecl=notdoxy7:{{.*}} notdoxy7 NOT_DOXYGEN +// CHECK: parse-all-comments.c:37:5: VarDecl=notdoxy8:{{.*}} notdoxy8 NOT_DOXYGEN +// CHECK-NOT: parse-all-comments.c:39:5: VarDecl=trdoxy9:{{.*}} trdoxyA IS_DOXYGEN_SINGLE +// CHECK: parse-all-comments.c:40:5: VarDecl=trdoxyA:{{.*}} trdoxyA IS_DOXYGEN_SINGLE +// CHECK: parse-all-comments.c:42:5: VarDecl=trdoxyB:{{.*}} PART_ONE {{.*}} trdoxyB NOT_DOXYGEN +// CHECK-NOT: parse-all-comments.c:44:5: VarDecl=trdoxyC:{{.*}} trdoxyB NOT_DOXYGEN +// CHECK: parse-all-comments.c:46:5: VarDecl=trdoxyD:{{.*}} trdoxyD NOT_DOXYGEN +// CHECK: parse-all-comments.c:48:5: VarDecl=trdoxyE:{{.*}} trdoxyE IS_DOXYGEN +// CHECK-NOT: parse-all-comments.c:50:5: VarDecl=trdoxyF:{{.*}} RawComment +// CHECK: parse-all-comments.c:52:5: VarDecl=trdoxyG:{{.*}} trdoxyG NOT_DOXYGEN +// CHECK: parse-all-comments.c:54:5: VarDecl=trdoxyH:{{.*}} PART_ONE {{.*}} trdoxyH SOME_DOXYGEN +// CHECK: parse-all-comments.c:56:5: VarDecl=trdoxyI:{{.*}} trdoxyI NOT_DOXYGEN +// CHECK: parse-all-comments.c:58:5: VarDecl=trdoxyJ:{{.*}} PART_ONE {{.*}} trdoxyJ SOME_DOXYGEN +// CHECK: parse-all-comments.c:60:5: VarDecl=trdoxyK:{{.*}} trdoxyK NOT_DOXYGEN +// CHECK: parse-all-comments.c:62:5: VarDecl=trdoxyL:{{.*}} trdoxyL NOT_DOXYGEN +// CHECK: parse-all-comments.c:64:5: VarDecl=trdoxyM:{{.*}} trdoxyM NOT_DOXYGEN +// CHECK: parse-all-comments.c:66:5: VarDecl=trdoxyN:{{.*}} trdoxyN IS_DOXYGEN +// CHECK: parse-all-comments.c:68:5: VarDecl=trdoxyO:{{.*}} trdoxyO NOT_DOXYGEN diff --git a/test/Index/pch-depending-on-deleted-module.c b/test/Index/pch-depending-on-deleted-module.c index a0fbaf559fcad..8efa66a32373c 100644 --- a/test/Index/pch-depending-on-deleted-module.c +++ b/test/Index/pch-depending-on-deleted-module.c @@ -9,6 +9,6 @@ // RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -I %S/Inputs/Headers -verify-pch %t/use_LibA.pch 2>&1 | FileCheck -check-prefix=VERIFY %s // RUN: not c-index-test -test-load-source all -x c -fmodules -fimplicit-module-maps -Xclang -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -I %S/Inputs/Headers -include-pch %t/use_LibA.pch %s 2>&1 | FileCheck -check-prefix=INDEX %s -// VERIFY: fatal error: malformed or corrupted AST file: 'Unable to load module +// VERIFY: fatal error: module file '{{.*}}LibA.pcm' not found // INDEX: {{^}}Failure: AST deserialization error occurred{{$}} diff --git a/test/Index/print-cxx-manglings.cpp b/test/Index/print-cxx-manglings.cpp new file mode 100644 index 0000000000000..aae2993017276 --- /dev/null +++ b/test/Index/print-cxx-manglings.cpp @@ -0,0 +1,66 @@ +// REQUIRES: x86-registered-target + +// RUN: c-index-test -write-pch %t.itanium.ast -target i686-pc-linux-gnu -fdeclspec %s +// RUN: c-index-test -test-print-manglings %t.itanium.ast | FileCheck --check-prefix=ITANIUM %s + +// RUN: c-index-test -write-pch %t.macho.ast -target i686-apple-darwin -fdeclspec %s +// RUN: c-index-test -test-print-manglings %t.macho.ast | FileCheck --check-prefix=MACHO %s + +// RUN: c-index-test -write-pch %t.msvc.ast -target i686-pc-windows %s +// RUN: c-index-test -test-print-manglings %t.msvc.ast | FileCheck --check-prefix=MSVC %s + +struct s { + s(int); + ~s(); + int m(int); +}; + +// ITANIUM: CXXConstructor=s{{.*}}[mangled=_ZN1sC2Ei] [mangled=_ZN1sC1Ei] +// ITANIUM: CXXDestructor=~s{{.*}}[mangled=_ZN1sD2Ev] [mangled=_ZN1sD1Ev] + +// MACHO: CXXConstructor=s{{.*}}[mangled=__ZN1sC2Ei] [mangled=__ZN1sC1Ei] +// MACHO: CXXDestructor=~s{{.*}}[mangled=__ZN1sD2Ev] [mangled=__ZN1sD1Ev] + +// MSVC: CXXConstructor=s{{.*}}[mangled=??0s@@QAE@H@Z] +// MSVC: CXXDestructor=~s{{.*}}[mangled=??1s@@QAE@XZ] + +struct t { + t(int); + virtual ~t(); + int m(int); +}; + +// ITANIUM: CXXConstructor=t{{.*}}[mangled=_ZN1tC2Ei] [mangled=_ZN1tC1Ei] +// ITANIUM: CXXDestructor=~t{{.*}}[mangled=_ZN1tD2Ev] [mangled=_ZN1tD1Ev] [mangled=_ZN1tD0Ev] + +// MACHO: CXXConstructor=t{{.*}}[mangled=__ZN1tC2Ei] [mangled=__ZN1tC1Ei] +// MACHO: CXXDestructor=~t{{.*}}[mangled=__ZN1tD2Ev] [mangled=__ZN1tD1Ev] [mangled=__ZN1tD0Ev] + +// MSVC: CXXConstructor=t{{.*}}[mangled=??0t@@QAE@H@Z] +// MSVC: CXXDestructor=~t{{.*}}[mangled=??1t@@UAE@XZ] + +struct u { + u(); + virtual ~u(); + virtual int m(int) = 0; +}; + +// ITANIUM: CXXConstructor=u{{.*}}[mangled=_ZN1uC2Ev] +// ITANIUM: CXXDestructor=~u{{.*}}[mangled=_ZN1uD2Ev] [mangled=_ZN1uD1Ev] [mangled=_ZN1uD0Ev] + +// MACHO: CXXConstructor=u{{.*}}[mangled=__ZN1uC2Ev] +// MACHO: CXXDestructor=~u{{.*}}[mangled=__ZN1uD2Ev] [mangled=__ZN1uD1Ev] [mangled=__ZN1uD0Ev] + +// MSVC: CXXConstructor=u{{.*}}[mangled=??0u@@QAE@XZ] +// MSVC: CXXDestructor=~u{{.*}}[mangled=??1u@@UAE@XZ] + +struct v { + __declspec(dllexport) v(int = 0); +}; + +// ITANIUM: CXXConstructor=v{{.*}}[mangled=_ZN1vC2Ei] [mangled=_ZN1vC1Ei] + +// MACHO: CXXConstructor=v{{.*}}[mangled=__ZN1vC2Ei] [mangled=__ZN1vC1Ei] + +// MSVC: CXXConstructor=v{{.*}}[mangled=??0v@@QAE@H@Z] [mangled=??_Fv@@QAEXXZ] + diff --git a/test/Index/print-mangled-name.cpp b/test/Index/print-mangled-name.cpp index d4edc5ff39212..dc6f734dfb734 100644 --- a/test/Index/print-mangled-name.cpp +++ b/test/Index/print-mangled-name.cpp @@ -1,11 +1,11 @@ // REQUIRES: x86-registered-target -// RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-pch %s -o %t_linux.ast +// RUN: c-index-test -write-pch %t_linux.ast -target i686-pc-linux-gnu %s // RUN: c-index-test -test-print-mangle %t_linux.ast | FileCheck %s --check-prefix=ITANIUM -// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-pch %s -o %t_macho.ast +// RUN: c-index-test -write-pch %t_macho.ast -target x86_64-apple-darwin %s // RUN: c-index-test -test-print-mangle %t_macho.ast | FileCheck %s --check-prefix=MACHO -// RUN: %clang_cc1 -triple i686-pc-win32 -emit-pch %s -o %t_msft.ast +// RUN: c-index-test -write-pch %t_msft.ast -target i686-pc-win32 %s // RUN: c-index-test -test-print-mangle %t_msft.ast | FileCheck %s --check-prefix=MICROSOFT int foo(int, int); @@ -29,3 +29,8 @@ int foo(S, S&); // ITANIUM: mangled=_Z3foo1SRS_ // MACHO: mangled=__Z3foo1SRS_ // MICROSOFT: mangled=?foo@@YAHUS + +extern "C" int foo(int); +// ITANIUM: mangled=foo +// MACHO: mangled=_foo +// MICROSOFT: mangled=_foo diff --git a/test/Index/print-type.cpp b/test/Index/print-type.cpp index f73f1b442f831..61135e3e8ace2 100644 --- a/test/Index/print-type.cpp +++ b/test/Index/print-type.cpp @@ -48,7 +48,15 @@ struct Blob { }; int Blob::*member_pointer; -// RUN: c-index-test -test-print-type %s -std=c++11 | FileCheck %s + + +auto autoI = 0; +auto autoTbar = tbar<int>(0); +auto autoBlob = new Blob(); +auto autoFunction(){return int();} +decltype(auto) autoInt = 5; + +// RUN: c-index-test -test-print-type %s -std=c++14 | FileCheck %s // CHECK: Namespace=outer:1:11 (Definition) [type=] [typekind=Invalid] [isPOD=0] // CHECK: ClassTemplate=Foo:4:8 (Definition) [type=] [typekind=Invalid] [isPOD=0] // CHECK: TemplateTypeParameter=T:3:19 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] @@ -119,3 +127,20 @@ int Blob::*member_pointer; // 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: VarDecl=autoI:53: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: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1] +// CHECK: VarDecl=autoBlob:55: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: 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: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1] diff --git a/test/Index/print-type.m b/test/Index/print-type.m index 5a4272b131b68..777069b3a58b3 100644 --- a/test/Index/print-type.m +++ b/test/Index/print-type.m @@ -3,6 +3,7 @@ -(int) mymethod; -(const id) mymethod2:(id)x blah:(Class)y boo:(SEL)z; -(bycopy)methodIn:(in int)i andOut:(out short *)j , ...; +-(void)kindof_meth:(__kindof Foo *)p; @end // RUN: c-index-test -test-print-type %s | FileCheck %s @@ -13,3 +14,4 @@ // 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] [isPOD=1] [pointeetype=Foo] [pointeekind=ObjCInterface] diff --git a/test/Index/skip-parsed-bodies/compile_commands.json b/test/Index/skip-parsed-bodies/compile_commands.json index 6707e84d2642a..30ede0db1015d 100644 --- a/test/Index/skip-parsed-bodies/compile_commands.json +++ b/test/Index/skip-parsed-bodies/compile_commands.json @@ -19,7 +19,8 @@ // XFAIL: mingw32,win32,windows-gnu // RUN: c-index-test -index-compile-db %s | FileCheck %s -// CHECK: [enteredMainFile]: t1.cpp +// CHECK: [startedTranslationUnit] +// CHECK-NEXT: [enteredMainFile]: t1.cpp // CHECK: [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: 1 // CHECK-NEXT: [indexEntityReference]: kind: variable | name: some_val | {{.*}} | loc: ./t.h:9:27 @@ -34,6 +35,7 @@ // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val2' // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_val3' +// CHECK-NEXT: [startedTranslationUnit] // CHECK-NEXT: [enteredMainFile]: t2.cpp // CHECK: [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped @@ -53,6 +55,7 @@ // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_tsval' // CHECK-NEXT: [diagnostic]: {{.*}} undeclared identifier 'undef_impval' +// CHECK-NEXT: [startedTranslationUnit] // CHECK-NEXT: [enteredMainFile]: t3.cpp // CHECK: [indexDeclaration]: kind: c++-instance-method | name: method_decl | {{.*}} | isRedecl: 0 | isDef: 0 | isContainer: 0 // CHECK-NEXT: [indexDeclaration]: kind: c++-instance-method | name: method_def1 | {{.*}} | isRedecl: 0 | isDef: 1 | isContainer: skipped diff --git a/test/Index/symbol-visibility.c b/test/Index/symbol-visibility.c new file mode 100644 index 0000000000000..014e80f818780 --- /dev/null +++ b/test/Index/symbol-visibility.c @@ -0,0 +1,7 @@ +// RUN: c-index-test -test-print-visibility %s | FileCheck %s + +__attribute__ ((visibility ("default"))) void foo1(); +__attribute__ ((visibility ("hidden"))) void foo2(); + +// CHECK: FunctionDecl=foo1:3:47visibility=Default +// CHECK: FunctionDecl=foo2:4:46visibility=Hidden diff --git a/test/Index/visibility.c b/test/Index/visibility.c new file mode 100644 index 0000000000000..1a71ab9b611ed --- /dev/null +++ b/test/Index/visibility.c @@ -0,0 +1,13 @@ +// RUN: c-index-test -index-file %s -target i686-pc-linux \ +// RUN: | FileCheck %s -check-prefix CHECK -check-prefix CHECK-LINUX +// RUN: c-index-test -index-file -Wno-unsupported-visibility %s -target i386-darwin \ +// RUN: | FileCheck %s -check-prefix CHECK -check-prefix CHECK-DARWIN + +void __attribute__ (( visibility("default") )) default_visibility(); +// CHECK: <attribute>: attribute(visibility)=default +void __attribute__ (( visibility("hidden") )) hidden_visibility(); +// CHECK: <attribute>: attribute(visibility)=hidden +void __attribute__ (( visibility("protected") )) protected_visibility(); +// CHECK-LINUX: <attribute>: attribute(visibility)=protected +// CHECK-DARWIN: <attribute>: attribute(visibility)=default + diff --git a/test/Index/warning-flags.c b/test/Index/warning-flags.c index b76662e9eedd1..af789c0443d25 100644 --- a/test/Index/warning-flags.c +++ b/test/Index/warning-flags.c @@ -5,8 +5,9 @@ int *bar(float *f) { return f; } // RUN: c-index-test -test-load-source-reparse 5 all %s 2>&1|FileCheck -check-prefix=CHECK-BOTH-WARNINGS %s // RUN: c-index-test -test-load-source all -Wno-return-type %s 2>&1|FileCheck -check-prefix=CHECK-SECOND-WARNING %s // RUN: c-index-test -test-load-source-reparse 5 all -Wno-return-type %s 2>&1|FileCheck -check-prefix=CHECK-SECOND-WARNING %s -// RUN: c-index-test -test-load-source all -w %s 2>&1|not grep warning: -// RUN: c-index-test -test-load-source-reparse 5 all -w %s 2>&1|not grep warning: +// RUN: c-index-test -test-load-source all -w %s 2>&1 | FileCheck -check-prefix=NOWARNINGS %s +// RUN: c-index-test -test-load-source-reparse 5 all -w %s 2>&1 | FileCheck -check-prefix=NOWARNINGS %s +// RUN: c-index-test -test-load-source all -w -O4 %s 2>&1 | FileCheck -check-prefix=NOWARNINGS %s // CHECK-BOTH-WARNINGS: warning: control reaches end of non-void function // CHECK-BOTH-WARNINGS: warning: incompatible pointer types returning 'float *' from a function with result type 'int *' @@ -14,3 +15,4 @@ int *bar(float *f) { return f; } // CHECK-SECOND-WARNING-NOT:control reaches end of non-void // CHECK-SECOND-WARNING: warning: incompatible pointer types returning 'float *' from a function with result type 'int *' +// NOWARNINGS-NOT: warning: |