diff options
Diffstat (limited to 'test/Index')
-rw-r--r-- | test/Index/annotate-module.m | 7 | ||||
-rw-r--r-- | test/Index/annotate-tokens.cpp | 55 | ||||
-rw-r--r-- | test/Index/annotate-tokens.m | 10 | ||||
-rw-r--r-- | test/Index/c-index-api-loadTU-test.m | 2 | ||||
-rw-r--r-- | test/Index/comment-cplus11-specific.cpp | 27 | ||||
-rw-r--r-- | test/Index/comment-misc-tags.m | 110 | ||||
-rw-r--r-- | test/Index/comment-unqualified-objc-pointer.m | 36 | ||||
-rw-r--r-- | test/Index/comment-with-preamble.c | 13 | ||||
-rw-r--r-- | test/Index/get-cursor.cpp | 25 | ||||
-rw-r--r-- | test/Index/index-refs.m | 9 | ||||
-rw-r--r-- | test/Index/load-classes.cpp | 20 | ||||
-rw-r--r-- | test/Index/parse-all-comments.c | 62 | ||||
-rw-r--r-- | test/Index/print-type-size.cpp | 428 | ||||
-rw-r--r-- | test/Index/print-type.c | 4 | ||||
-rw-r--r-- | test/Index/print-type.cpp | 5 | ||||
-rw-r--r-- | test/Index/print-type.m | 7 | ||||
-rw-r--r-- | test/Index/properties-class-extensions.m | 10 | ||||
-rw-r--r-- | test/Index/subclass-comment.mm | 107 | ||||
-rw-r--r-- | test/Index/targeted-annotation.c | 8 | ||||
-rw-r--r-- | test/Index/usrs.m | 7 |
20 files changed, 922 insertions, 30 deletions
diff --git a/test/Index/annotate-module.m b/test/Index/annotate-module.m index 33ca3f8..55e21d2 100644 --- a/test/Index/annotate-module.m +++ b/test/Index/annotate-module.m @@ -40,3 +40,10 @@ int glob; // CHECK-MOD-NEXT: Punctuation: "*" [2:5 - 2:6] VarDecl=Module_Sub:2:6 // CHECK-MOD-NEXT: Identifier: "Module_Sub" [2:6 - 2:16] VarDecl=Module_Sub:2:6 // CHECK-MOD-NEXT: Punctuation: ";" [2:16 - 2:17] + +// RUN: c-index-test -cursor-at=%s:3:11 %s -fmodules-cache-path=%t.cache -fmodules -F %S/../Modules/Inputs \ +// RUN: | FileCheck %s -check-prefix=CHECK-CURSOR + +// CHECK-CURSOR: 3:1 ModuleImport=DependsOnModule:3:1 (Definition) Extent=[3:1 - 3:24] Spelling=DependsOnModule ([3:9 - 3:24]) ModuleName=DependsOnModule ({{.*}}DependsOnModule.pcm) Headers(2): +// CHECK-CURSOR-NEXT: {{.*}}other.h +// CHECK-CURSOR-NEXT: {{.*}}DependsOnModule.h diff --git a/test/Index/annotate-tokens.cpp b/test/Index/annotate-tokens.cpp index 3062901..1672654 100644 --- a/test/Index/annotate-tokens.cpp +++ b/test/Index/annotate-tokens.cpp @@ -20,7 +20,15 @@ void test3(S2 s2) { X foo; } -// RUN: c-index-test -test-annotate-tokens=%s:1:1:21:1 %s | FileCheck %s +template <bool (*tfn)(X*)> +struct TS { + void foo(); +}; + +template <bool (*tfn)(X*)> +void TS<tfn>::foo() {} + +// RUN: c-index-test -test-annotate-tokens=%s:1:1:30:1 %s -fno-delayed-template-parsing | FileCheck %s // CHECK: Keyword: "struct" [1:1 - 1:7] StructDecl=bonk:1:8 (Definition) // CHECK: Identifier: "bonk" [1:8 - 1:12] StructDecl=bonk:1:8 (Definition) // CHECK: Punctuation: "{" [1:13 - 1:14] StructDecl=bonk:1:8 (Definition) @@ -120,3 +128,48 @@ void test3(S2 s2) { // CHECK: Identifier: "foo" [20:5 - 20:8] VarDecl=foo:20:5 (Definition) // CHECK: Punctuation: ";" [20:8 - 20:9] DeclStmt= // CHECK: Punctuation: "}" [21:1 - 21:2] CompoundStmt= +// CHECK: Keyword: "template" [23:1 - 23:9] ClassTemplate=TS:24:8 (Definition) +// CHECK: Punctuation: "<" [23:10 - 23:11] ClassTemplate=TS:24:8 (Definition) +// CHECK: Keyword: "bool" [23:11 - 23:15] NonTypeTemplateParameter=tfn:23:18 (Definition) +// CHECK: Punctuation: "(" [23:16 - 23:17] NonTypeTemplateParameter=tfn:23:18 (Definition) +// CHECK: Punctuation: "*" [23:17 - 23:18] NonTypeTemplateParameter=tfn:23:18 (Definition) +// CHECK: Identifier: "tfn" [23:18 - 23:21] NonTypeTemplateParameter=tfn:23:18 (Definition) +// CHECK: Punctuation: ")" [23:21 - 23:22] NonTypeTemplateParameter=tfn:23:18 (Definition) +// CHECK: Punctuation: "(" [23:22 - 23:23] NonTypeTemplateParameter=tfn:23:18 (Definition) +// CHECK: Identifier: "X" [23:23 - 23:24] TypeRef=struct X:7:8 +// CHECK: Punctuation: "*" [23:24 - 23:25] ParmDecl=:23:25 (Definition) +// CHECK: Punctuation: ")" [23:25 - 23:26] ParmDecl=:23:25 (Definition) +// CHECK: Punctuation: ">" [23:26 - 23:27] ClassTemplate=TS:24:8 (Definition) +// CHECK: Keyword: "struct" [24:1 - 24:7] ClassTemplate=TS:24:8 (Definition) +// CHECK: Identifier: "TS" [24:8 - 24:10] ClassTemplate=TS:24:8 (Definition) +// CHECK: Punctuation: "{" [24:11 - 24:12] ClassTemplate=TS:24:8 (Definition) +// CHECK: Keyword: "void" [25:3 - 25:7] CXXMethod=foo:25:8 +// CHECK: Identifier: "foo" [25:8 - 25:11] CXXMethod=foo:25:8 +// CHECK: Punctuation: "(" [25:11 - 25:12] CXXMethod=foo:25:8 +// CHECK: Punctuation: ")" [25:12 - 25:13] CXXMethod=foo:25:8 +// CHECK: Punctuation: ";" [25:13 - 25:14] ClassTemplate=TS:24:8 (Definition) +// CHECK: Punctuation: "}" [26:1 - 26:2] ClassTemplate=TS:24:8 (Definition) +// CHECK: Punctuation: ";" [26:2 - 26:3] +// CHECK: Keyword: "template" [28:1 - 28:9] CXXMethod=foo:29:15 (Definition) +// CHECK: Punctuation: "<" [28:10 - 28:11] CXXMethod=foo:29:15 (Definition) +// CHECK: Keyword: "bool" [28:11 - 28:15] NonTypeTemplateParameter=tfn:28:18 (Definition) +// CHECK: Punctuation: "(" [28:16 - 28:17] NonTypeTemplateParameter=tfn:28:18 (Definition) +// CHECK: Punctuation: "*" [28:17 - 28:18] NonTypeTemplateParameter=tfn:28:18 (Definition) +// CHECK: Identifier: "tfn" [28:18 - 28:21] NonTypeTemplateParameter=tfn:28:18 (Definition) +// CHECK: Punctuation: ")" [28:21 - 28:22] NonTypeTemplateParameter=tfn:28:18 (Definition) +// CHECK: Punctuation: "(" [28:22 - 28:23] NonTypeTemplateParameter=tfn:28:18 (Definition) +// CHECK: Identifier: "X" [28:23 - 28:24] TypeRef=struct X:7:8 +// CHECK: Punctuation: "*" [28:24 - 28:25] ParmDecl=:28:25 (Definition) +// CHECK: Punctuation: ")" [28:25 - 28:26] ParmDecl=:28:25 (Definition) +// CHECK: Punctuation: ">" [28:26 - 28:27] CXXMethod=foo:29:15 (Definition) +// CHECK: Keyword: "void" [29:1 - 29:5] CXXMethod=foo:29:15 (Definition) +// CHECK: Identifier: "TS" [29:6 - 29:8] TemplateRef=TS:24:8 +// CHECK: Punctuation: "<" [29:8 - 29:9] CXXMethod=foo:29:15 (Definition) +// CHECK: Identifier: "tfn" [29:9 - 29:12] DeclRefExpr=tfn:28:18 +// CHECK: Punctuation: ">" [29:12 - 29:13] CXXMethod=foo:29:15 (Definition) +// CHECK: Punctuation: "::" [29:13 - 29:15] CXXMethod=foo:29:15 (Definition) +// CHECK: Identifier: "foo" [29:15 - 29:18] CXXMethod=foo:29:15 (Definition) +// CHECK: Punctuation: "(" [29:18 - 29:19] CXXMethod=foo:29:15 (Definition) +// CHECK: Punctuation: ")" [29:19 - 29:20] CXXMethod=foo:29:15 (Definition) +// CHECK: Punctuation: "{" [29:21 - 29:22] CompoundStmt= +// CHECK: Punctuation: "}" [29:22 - 29:23] CompoundStmt= diff --git a/test/Index/annotate-tokens.m b/test/Index/annotate-tokens.m index 7e888e3..40c66a1 100644 --- a/test/Index/annotate-tokens.m +++ b/test/Index/annotate-tokens.m @@ -281,7 +281,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Punctuation: ")" [40:19 - 40:20] CallExpr=ibaction_test:36:12 // CHECK: Punctuation: ";" [40:20 - 40:21] CompoundStmt= // CHECK: Punctuation: "[" [41:5 - 41:6] ObjCMessageExpr=foo::34:9 -// CHECK: Identifier: "self" [41:6 - 41:10] DeclRefExpr=self:0:0 +// CHECK: Identifier: "self" [41:6 - 41:10] ObjCSelfExpr=self:0:0 // CHECK: Identifier: "foo" [41:11 - 41:14] ObjCMessageExpr=foo::34:9 // CHECK: Punctuation: ":" [41:14 - 41:15] ObjCMessageExpr=foo::34:9 // CHECK: Literal: "0" [41:15 - 41:16] IntegerLiteral= @@ -391,7 +391,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Identifier: "local" [76:9 - 76:14] VarDecl=local:76:9 (Definition) // CHECK: Punctuation: "=" [76:15 - 76:16] VarDecl=local:76:9 (Definition) // CHECK: Punctuation: "[" [76:17 - 76:18] ObjCMessageExpr=foo::66:9 -// CHECK: Identifier: "self" [76:18 - 76:22] DeclRefExpr=self:0:0 +// CHECK: Identifier: "self" [76:18 - 76:22] ObjCSelfExpr=self:0:0 // CHECK: Identifier: "foo" [76:23 - 76:26] ObjCMessageExpr=foo::66:9 // CHECK: Punctuation: ":" [76:26 - 76:27] ObjCMessageExpr=foo::66:9 // CHECK: Identifier: "VAL" [76:27 - 76:30] macro expansion=VAL:63:9 @@ -401,7 +401,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK: Identifier: "second" [77:9 - 77:15] VarDecl=second:77:9 (Definition) // CHECK: Punctuation: "=" [77:16 - 77:17] VarDecl=second:77:9 (Definition) // CHECK: Punctuation: "[" [77:18 - 77:19] ObjCMessageExpr=foo::66:9 -// CHECK: Identifier: "self" [77:19 - 77:23] DeclRefExpr=self:0:0 +// CHECK: Identifier: "self" [77:19 - 77:23] ObjCSelfExpr=self:0:0 // CHECK: Identifier: "foo" [77:24 - 77:27] ObjCMessageExpr=foo::66:9 // CHECK: Punctuation: ":" [77:27 - 77:28] ObjCMessageExpr=foo::66:9 // CHECK: Literal: "0" [77:28 - 77:29] IntegerLiteral= @@ -518,7 +518,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK-INSIDE_BLOCK: Identifier: "result" [127:9 - 127:15] VarDecl=result:127:9 (Definition) // CHECK-INSIDE_BLOCK: Punctuation: "=" [127:16 - 127:17] VarDecl=result:127:9 (Definition) // CHECK-INSIDE_BLOCK: Punctuation: "[" [127:18 - 127:19] ObjCMessageExpr=blah::124:8 -// CHECK-INSIDE_BLOCK: Identifier: "self" [127:19 - 127:23] DeclRefExpr=self:0:0 +// CHECK-INSIDE_BLOCK: Identifier: "self" [127:19 - 127:23] ObjCSelfExpr=self:0:0 // CHECK-INSIDE_BLOCK: Identifier: "blah" [127:24 - 127:28] ObjCMessageExpr=blah::124:8 // CHECK-INSIDE_BLOCK: Punctuation: ":" [127:28 - 127:29] ObjCMessageExpr=blah::124:8 // CHECK-INSIDE_BLOCK: Literal: "5" [127:29 - 127:30] IntegerLiteral= @@ -530,7 +530,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK-INSIDE_BLOCK: Punctuation: "*" [128:17 - 128:18] VarDecl=a:128:18 (Definition) // CHECK-INSIDE_BLOCK: Identifier: "a" [128:18 - 128:19] VarDecl=a:128:18 (Definition) // CHECK-INSIDE_BLOCK: Punctuation: "=" [128:20 - 128:21] VarDecl=a:128:18 (Definition) -// CHECK-INSIDE_BLOCK: Identifier: "self" [128:22 - 128:26] DeclRefExpr=self:0:0 +// CHECK-INSIDE_BLOCK: Identifier: "self" [128:22 - 128:26] ObjCSelfExpr=self:0:0 // RUN: c-index-test -test-annotate-tokens=%s:134:1:138:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' | FileCheck -check-prefix=CHECK-PROP-AFTER-METHOD %s // CHECK-PROP-AFTER-METHOD: Punctuation: "@" [134:1 - 134:2] ObjCInterfaceDecl=Rdar8062781:134:12 diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m index b0fb71e..61d82a6 100644 --- a/test/Index/c-index-api-loadTU-test.m +++ b/test/Index/c-index-api-loadTU-test.m @@ -169,7 +169,7 @@ struct X0 {}; // CHECK: c-index-api-loadTU-test.m:71:8: StructDecl=X0:71:8 (Definition) Extent=[71:1 - 71:14] // CHECK: c-index-api-loadTU-test.m:73:12: ObjCCategoryDecl=:73:12 Extent=[73:1 - 76:5] // CHECK: c-index-api-loadTU-test.m:73:12: ObjCClassRef=TestAttributes:62:12 Extent=[73:12 - 73:26] -// CHECK: c-index-api-loadTU-test.m:75:32: ObjCPropertyDecl=anotherOutlet:75:32 Extent=[75:1 - 75:45] +// CHECK: c-index-api-loadTU-test.m:75:32: ObjCPropertyDecl=anotherOutlet:75:32 [retain,] Extent=[75:1 - 75:45] // CHECK: <invalid loc>:0:0: attribute(iboutlet)= Extent=[75:20 - 75:28] // CHECK: c-index-api-loadTU-test.m:75:29: TypeRef=id:0:0 Extent=[75:29 - 75:31] // CHECK: c-index-api-loadTU-test.m:75:32: ObjCInstanceMethodDecl=anotherOutlet:75:32 Extent=[75:32 - 75:45] diff --git a/test/Index/comment-cplus11-specific.cpp b/test/Index/comment-cplus11-specific.cpp new file mode 100644 index 0000000..fa0db91 --- /dev/null +++ b/test/Index/comment-cplus11-specific.cpp @@ -0,0 +1,27 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng std=c++11 %s > %t/out +// RUN: FileCheck %s < %t/out +// rdar://13752382 + +namespace inner { + //! This documentation should be inherited. + struct Opaque; +} +// CHECK: (CXComment_Text Text=[ This documentation should be inherited.])))] + +namespace borrow { + //! This is documentation for the typedef (which shows up). + typedef inner::Opaque Typedef; +// CHECK: (CXComment_Text Text=[ This is documentation for the typedef (which shows up).])))] + + //! This is documentation for the alias (which shows up). + using Alias = inner::Opaque; +// CHECK: (CXComment_Text Text=[ This is documentation for the alias (which shows up).])))] + + typedef inner::Opaque NoDocTypedef; +// CHECK: (CXComment_Text Text=[ This documentation should be inherited.])))] + + using NoDocAlias = inner::Opaque; +// CHECK: (CXComment_Text Text=[ This documentation should be inherited.])))] +} diff --git a/test/Index/comment-misc-tags.m b/test/Index/comment-misc-tags.m new file mode 100644 index 0000000..9eae548 --- /dev/null +++ b/test/Index/comment-misc-tags.m @@ -0,0 +1,110 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s > %t/out +// RUN: FileCheck %s < %t/out +// rdar://12379114 + +/*! + @interface IOCommandGate + @brief This is a brief + @abstract Single-threaded work-loop client request mechanism. + @discussion An IOCommandGate instance is an extremely light weight mechanism that + executes an action on the driver's work-loop... + @textblock + Many discussions about text + Many1 discussions about text + Many2 discussions about text + @/textblock + @link //un_ref/c/func/function_name link text goes here @/link + @see //un_ref/doc/uid/XX0000011 I/O Kit Fundamentals + @seealso //k_ref/doc/uid/XX30000905-CH204 Programming + */ +@interface IOCommandGate +@end + +// CHECK: (CXComment_BlockCommand CommandName=[abstract] +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ Single-threaded work-loop client request mechanism.] HasTrailingNewline) +// CHECK: (CXComment_BlockCommand CommandName=[discussion] +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ An IOCommandGate instance is an extremely light weight mechanism that] HasTrailingNewline) +// CHECK-NEXT: (CXComment_Text Text=[ executes an action on the driver's work-loop...] HasTrailingNewline) +// CHECK: (CXComment_VerbatimBlockCommand CommandName=[textblock] +// CHECK-NEXT: (CXComment_VerbatimBlockLine Text=[ Many discussions about text]) +// CHECK-NEXT: (CXComment_VerbatimBlockLine Text=[ Many1 discussions about text]) +// CHECK-NEXT: (CXComment_VerbatimBlockLine Text=[ Many2 discussions about text])) +// CHECK-NEXT: (CXComment_Paragraph IsWhitespace + +// CHECK: (CXComment_VerbatimBlockCommand CommandName=[link] +// CHECK-NEXT: (CXComment_VerbatimBlockLine Text=[ //un_ref/c/func/function_name link text goes here ])) +// CHECK-NEXT: (CXComment_Paragraph IsWhitespace +// CHECK-NEXT: (CXComment_Text Text=[ ] IsWhitespace)) +// CHECK: (CXComment_BlockCommand CommandName=[see] +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ //un_ref/doc/uid/XX0000011 I/O Kit Fundamentals] HasTrailingNewline) +// CHECK-NEXT: (CXComment_Text Text=[ ] IsWhitespace))) +// CHECK: (CXComment_BlockCommand CommandName=[seealso] +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ //k_ref/doc/uid/XX30000905-CH204 Programming] HasTrailingNewline) + +// rdar://12379053 +/*! +\arg \c AlignLeft left alignment. +\li \c AlignRight right alignment. + + No other types of alignment are supported. +*/ +struct S { + int AlignLeft; + int AlignRight; +}; + +// CHECK: (CXComment_BlockCommand CommandName=[arg] +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ ] IsWhitespace) +// CHECK-NEXT: (CXComment_InlineCommand CommandName=[c] RenderMonospaced Arg[0]=AlignLeft) +// CHECK-NEXT: (CXComment_Text Text=[ left alignment.] HasTrailingNewline))) +// CHECK: (CXComment_BlockCommand CommandName=[li] +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ ] IsWhitespace) +// CHECK-NEXT: (CXComment_InlineCommand CommandName=[c] RenderMonospaced Arg[0]=AlignRight) +// CHECK-NEXT: (CXComment_Text Text=[ right alignment.]))) +// CHECK: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ No other types of alignment are supported.])) + +// rdar://12379053 +/*! \struct Test + * Normal text. + * + * \par User defined paragraph: + * Contents of the paragraph. + * + * \par + * New paragraph under the same heading. + * + * \note + * This note consists of two paragraphs. + * This is the first paragraph. + * + * \par + * And this is the second paragraph. + * + * More normal text. + */ + +struct Test {int filler;}; + +// CHECK: (CXComment_BlockCommand CommandName=[par] +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ User defined paragraph:] HasTrailingNewline) +// CHECK-NEXT: (CXComment_Text Text=[ Contents of the paragraph.]))) +// CHECK: (CXComment_BlockCommand CommandName=[par] +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ New paragraph under the same heading.]))) +// CHECK: (CXComment_BlockCommand CommandName=[note] +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ This note consists of two paragraphs.] HasTrailingNewline) +// CHECK-NEXT: (CXComment_Text Text=[ This is the first paragraph.]))) +// CHECK: (CXComment_BlockCommand CommandName=[par] +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ And this is the second paragraph.]))) diff --git a/test/Index/comment-unqualified-objc-pointer.m b/test/Index/comment-unqualified-objc-pointer.m new file mode 100644 index 0000000..546d4fa --- /dev/null +++ b/test/Index/comment-unqualified-objc-pointer.m @@ -0,0 +1,36 @@ +// RUN: rm -rf %t +// 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 -fobjc-default-synthesize-properties -fobjc-arc %s > %t/out +// RUN: FileCheck %s < %t/out +// rdar://13757500 + +@class NSString; + +@interface NSArray @end + +@interface NSMutableArray : NSArray +{ +//! This is the name. + NSString *Name; +} +//! This is WithLabel comment. +- (NSString *)WithLabel:(NSString * const)label; +// CHECK: <Declaration>- (NSString *)WithLabel:(NSString *const)label;</Declaration> + +//! This is a property to get the Name. +@property (copy) NSString *Name; +// CHECK: <Declaration>@property(readwrite, copy, atomic) NSString *Name;</Declaration> +@end + +@implementation NSMutableArray +{ +//! This is private ivar + NSString *NickName; +// CHECK: <Declaration>NSString *NickName</Declaration> +} + +- (NSString *)WithLabel:(NSString * const)label { + return 0; +} +@synthesize Name = Name; +@end diff --git a/test/Index/comment-with-preamble.c b/test/Index/comment-with-preamble.c new file mode 100644 index 0000000..72e6140 --- /dev/null +++ b/test/Index/comment-with-preamble.c @@ -0,0 +1,13 @@ +// Make sure the preable does not truncate comments. + +#ifndef BAZ +#define BAZ 3 +#endif + +//! Foo’s description. +void Foo(); + +// RUN: c-index-test -test-load-source-reparse 1 local %s | FileCheck %s +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 1 local %s | FileCheck %s + +// CHECK: FunctionDecl=Foo:8:6 RawComment=[//! Foo’s description.] RawCommentRange=[7:1 - 7:25] BriefComment=[Foo’s description.] diff --git a/test/Index/get-cursor.cpp b/test/Index/get-cursor.cpp index 8b70216..996ecc2 100644 --- a/test/Index/get-cursor.cpp +++ b/test/Index/get-cursor.cpp @@ -47,6 +47,24 @@ void test() { }; } +template <bool (*tfn)(X*)> +struct TS { + void foo(); +}; + +template <bool (*tfn)(X*)> +void TS<tfn>::foo() {} + +template <typename T> +class TC { + void init(); +}; + +template<> void TC<char>::init(); + +#define EXTERN_TEMPLATE(...) extern template __VA_ARGS__; +EXTERN_TEMPLATE(class TC<char>) + // RUN: c-index-test -cursor-at=%s:6:4 %s | FileCheck -check-prefix=CHECK-COMPLETION-1 %s // CHECK-COMPLETION-1: CXXConstructor=X:6:3 // CHECK-COMPLETION-1-NEXT: Completion string: {TypedText X}{LeftParen (}{Placeholder int}{Comma , }{Placeholder int}{RightParen )} @@ -103,3 +121,10 @@ void test() { // RUN: c-index-test -cursor-at=%s:45:9 %s | FileCheck -check-prefix=CHECK-LOCALCLASS %s // CHECK-LOCALCLASS: 45:9 DeclRefExpr=x:44:11 Extent=[45:9 - 45:10] Spelling=x ([45:9 - 45:10]) + +// RUN: c-index-test -cursor-at=%s:50:23 -cursor-at=%s:55:23 %s | FileCheck -check-prefix=CHECK-TEMPLPARAM %s +// CHECK-TEMPLPARAM: 50:23 TypeRef=struct X:3:8 Extent=[50:23 - 50:24] Spelling=struct X ([50:23 - 50:24]) +// CHECK-TEMPLPARAM: 55:23 TypeRef=struct X:3:8 Extent=[55:23 - 55:24] Spelling=struct X ([55:23 - 55:24]) + +// RUN: c-index-test -cursor-at=%s:66:23 %s | FileCheck -check-prefix=CHECK-TEMPLSPEC %s +// CHECK-TEMPLSPEC: 66:23 ClassDecl=TC:66:23 (Definition) [Specialization of TC:59:7] Extent=[66:1 - 66:31] Spelling=TC ([66:23 - 66:25]) diff --git a/test/Index/index-refs.m b/test/Index/index-refs.m index b82345f..f25013b 100644 --- a/test/Index/index-refs.m +++ b/test/Index/index-refs.m @@ -13,6 +13,15 @@ void foo() { @encode(struct FooS); } +@interface I ++(void)clsMeth; +@end + +void foo2() { + [I clsMeth]; +} + // RUN: c-index-test -index-file %s | FileCheck %s // CHECK: [indexEntityReference]: kind: objc-protocol | name: Prot | {{.*}} | loc: 12:27 // CHECK: [indexEntityReference]: kind: struct | name: FooS | {{.*}} | loc: 13:18 +// CHECK: [indexEntityReference]: kind: objc-class | name: I | {{.*}} | loc: 21:4 diff --git a/test/Index/load-classes.cpp b/test/Index/load-classes.cpp index 5877019..db7b48f 100644 --- a/test/Index/load-classes.cpp +++ b/test/Index/load-classes.cpp @@ -3,7 +3,9 @@ struct X { X(int value); X(const X& x); +protected: ~X(); +private: operator X*(); }; @@ -11,18 +13,18 @@ X::X(int value) { } // RUN: c-index-test -test-load-source all %s | FileCheck %s -// CHECK: load-classes.cpp:3:8: StructDecl=X:3:8 (Definition) Extent=[3:1 - 8:2] -// CHECK: load-classes.cpp:4:3: CXXConstructor=X:4:3 Extent=[4:3 - 4:15] +// CHECK: load-classes.cpp:3:8: StructDecl=X:3:8 (Definition) Extent=[3:1 - 10:2] +// CHECK: load-classes.cpp:4:3: CXXConstructor=X:4:3 Extent=[4:3 - 4:15] [access=public] // FIXME: missing TypeRef in the constructor name // CHECK: load-classes.cpp:4:9: ParmDecl=value:4:9 (Definition) Extent=[4:5 - 4:14] -// CHECK: load-classes.cpp:5:3: CXXConstructor=X:5:3 Extent=[5:3 - 5:16] +// CHECK: load-classes.cpp:5:3: CXXConstructor=X:5:3 Extent=[5:3 - 5:16] [access=public] // FIXME: missing TypeRef in the constructor name // CHECK: load-classes.cpp:5:14: ParmDecl=x:5:14 (Definition) Extent=[5:5 - 5:15] // CHECK: load-classes.cpp:5:11: TypeRef=struct X:3:8 Extent=[5:11 - 5:12] -// CHECK: load-classes.cpp:6:3: CXXDestructor=~X:6:3 Extent=[6:3 - 6:7] +// CHECK: load-classes.cpp:7:3: CXXDestructor=~X:7:3 Extent=[7:3 - 7:7] [access=protected] // FIXME: missing TypeRef in the destructor name -// CHECK: load-classes.cpp:7:3: CXXConversion=operator struct X *:7:3 Extent=[7:3 - 7:16] -// CHECK: load-classes.cpp:7:12: TypeRef=struct X:3:8 Extent=[7:12 - 7:13] -// CHECK: load-classes.cpp:10:4: CXXConstructor=X:10:4 (Definition) Extent=[10:1 - 11:2] -// CHECK: load-classes.cpp:10:1: TypeRef=struct X:3:8 Extent=[10:1 - 10:2] -// CHECK: load-classes.cpp:10:10: ParmDecl=value:10:10 (Definition) Extent=[10:6 - 10:15] +// CHECK: load-classes.cpp:9:3: CXXConversion=operator struct X *:9:3 Extent=[9:3 - 9:16] [access=private] +// CHECK: load-classes.cpp:9:12: TypeRef=struct X:3:8 Extent=[9:12 - 9:13] +// CHECK: load-classes.cpp:12:4: CXXConstructor=X:12:4 (Definition) Extent=[12:1 - 13:2] [access=public] +// CHECK: load-classes.cpp:12:1: TypeRef=struct X:3:8 Extent=[12:1 - 12:2] +// CHECK: load-classes.cpp:12:10: ParmDecl=value:12:10 (Definition) Extent=[12:6 - 12:15] diff --git a/test/Index/parse-all-comments.c b/test/Index/parse-all-comments.c new file mode 100644 index 0000000..f8b0449 --- /dev/null +++ b/test/Index/parse-all-comments.c @@ -0,0 +1,62 @@ +// Run lines are sensitive to line numbers and come below the code. + +#ifndef HEADER +#define HEADER + +// Not a Doxygen comment. notdoxy1 NOT_DOXYGEN +void notdoxy1(void); + +/* Not a Doxygen comment. notdoxy2 NOT_DOXYGEN */ +void notdoxy2(void); + +/*/ Not a Doxygen comment. notdoxy3 NOT_DOXYGEN */ +void notdoxy3(void); + +/** Doxygen comment. isdoxy4 IS_DOXYGEN_SINGLE */ +void isdoxy4(void); + +/*! Doxygen comment. isdoxy5 IS_DOXYGEN_SINGLE */ +void isdoxy5(void); + +/// Doxygen comment. isdoxy6 IS_DOXYGEN_SINGLE +void isdoxy6(void); + +/* BLOCK_ORDINARY_COMMENT */ +// ORDINARY COMMENT +/// This is a BCPL comment. IS_DOXYGEN_START +/// It has only two lines. +/** But there are other blocks that are part of the comment, too. IS_DOXYGEN_END */ +void multi_line_comment_plus_ordinary(int); + +// MULTILINE COMMENT +// +// WITH EMPTY LINE +void multi_line_comment_empty_line(int); + +#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 -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 + +// RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-direct +// RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-pch + +// Ensure that XML is not invalid +// WRONG-NOT: CommentXMLInvalid + +// RUN: FileCheck %s < %t/out.c-index-direct +// RUN: FileCheck %s < %t/out.c-index-pch + +// CHECK: parse-all-comments.c:7:6: FunctionDecl=notdoxy1:{{.*}} notdoxy1 NOT_DOXYGEN +// CHECK: parse-all-comments.c:10:6: FunctionDecl=notdoxy2:{{.*}} notdoxy2 NOT_DOXYGEN +// CHECK: parse-all-comments.c:13:6: FunctionDecl=notdoxy3:{{.*}} notdoxy3 NOT_DOXYGEN +// CHECK: parse-all-comments.c:16:6: FunctionDecl=isdoxy4:{{.*}} isdoxy4 IS_DOXYGEN_SINGLE +// CHECK: parse-all-comments.c:19:6: FunctionDecl=isdoxy5:{{.*}} isdoxy5 IS_DOXYGEN_SINGLE +// 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 diff --git a/test/Index/print-type-size.cpp b/test/Index/print-type-size.cpp new file mode 100644 index 0000000..698d967 --- /dev/null +++ b/test/Index/print-type-size.cpp @@ -0,0 +1,428 @@ +// from SemaCXX/class-layout.cpp +// RUN: c-index-test -test-print-type-size %s -target x86_64-pc-linux-gnu | FileCheck -check-prefix=CHECK64 %s +// RUN: c-index-test -test-print-type-size %s -target i386-apple-darwin9 | FileCheck -check-prefix=CHECK32 %s + +namespace basic { + +// CHECK64: VarDecl=v:[[@LINE+2]]:6 (Definition) [type=void] [typekind=Void] +// CHECK32: VarDecl=v:[[@LINE+1]]:6 (Definition) [type=void] [typekind=Void] +void v; + +// CHECK64: VarDecl=v1:[[@LINE+2]]:7 (Definition) [type=void *] [typekind=Pointer] [sizeof=8] [alignof=8] +// CHECK32: VarDecl=v1:[[@LINE+1]]:7 (Definition) [type=void *] [typekind=Pointer] [sizeof=4] [alignof=4] +void *v1; + +// offsetof +// CHECK64: StructDecl=simple:[[@LINE+2]]:8 (Definition) [type=basic::simple] [typekind=Record] [sizeof=48] [alignof=8] +// CHECK32: StructDecl=simple:[[@LINE+1]]:8 (Definition) [type=basic::simple] [typekind=Record] [sizeof=36] [alignof=4] +struct simple { + int a; + char b; +// CHECK64: FieldDecl=c:[[@LINE+1]]:7 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=40] [BitFieldSize=3] + int c:3; + long d; + int e:5; +// CHECK64: FieldDecl=f:[[@LINE+1]]:7 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=133] [BitFieldSize=4] + int f:4; +// CHECK64: FieldDecl=g:[[@LINE+2]]:13 (Definition) [type=long long] [typekind=LongLong] [sizeof=8] [alignof=8] [offsetof=192] +// CHECK32: FieldDecl=g:[[@LINE+1]]:13 (Definition) [type=long long] [typekind=LongLong] [sizeof=8] [alignof=4] [offsetof=128] + long long g; +// CHECK64: FieldDecl=h:[[@LINE+1]]:8 (Definition) [type=char] [typekind=Char_S] [sizeof=1] [alignof=1] [offsetof=256] [BitFieldSize=3] + char h:3; + char i:3; + float j; +// CHECK64: FieldDecl=k:[[@LINE+2]]:10 (Definition) [type=char *] [typekind=Pointer] [sizeof=8] [alignof=8] [offsetof=320] +// CHECK32: FieldDecl=k:[[@LINE+1]]:10 (Definition) [type=char *] [typekind=Pointer] [sizeof=4] [alignof=4] [offsetof=256] + char * k; +}; + + +// CHECK64: UnionDecl=u:[[@LINE+2]]:7 (Definition) [type=basic::u] [typekind=Record] [sizeof=48] [alignof=8] +// CHECK32: UnionDecl=u:[[@LINE+1]]:7 (Definition) [type=basic::u] [typekind=Record] [sizeof=36] [alignof=4] +union u { + int u1; + long long u2; + struct simple s1; +}; + +// CHECK64: VarDecl=s1:[[@LINE+2]]:8 (Definition) [type=basic::simple] [typekind=Record] [sizeof=48] [alignof=8] +// CHECK32: VarDecl=s1:[[@LINE+1]]:8 (Definition) [type=basic::simple] [typekind=Record] [sizeof=36] [alignof=4] +simple s1; + +struct Test { + struct { + union { +//CHECK64: FieldDecl=foo:[[@LINE+1]]:11 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=0] + int foo; + }; + }; +}; + +struct Test2 { + struct { + struct { +//CHECK64: FieldDecl=foo:[[@LINE+1]]:11 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=0] + int foo; + }; + struct { +//CHECK64: FieldDecl=bar:[[@LINE+1]]:11 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=32] + int bar; + }; + struct { + struct { +//CHECK64: FieldDecl=foobar:[[@LINE+1]]:15 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=64] + int foobar; + }; + }; + struct inner { + struct { +//CHECK64: FieldDecl=mybar:[[@LINE+1]]:15 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=0] + int mybar; + }; +//CHECK64: FieldDecl=mole:[[@LINE+1]]:7 (Definition) [type=struct inner] [typekind=Unexposed] [sizeof=4] [alignof=4] [offsetof=96] + } mole; + }; +}; + +} + +// these are test crash. Offsetof return values are not important. +namespace Incomplete { +// test that fields in incomplete named record do not crash +union named { + struct forward_decl f1; +//CHECK64: FieldDecl=f2:[[@LINE+1]]:7 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=-2] + int f2; + struct x { +//CHECK64: FieldDecl=g1:[[@LINE+1]]:9 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=0] + int g1; +//CHECK64: FieldDecl=f3:[[@LINE+1]]:5 (Definition) [type=struct x] [typekind=Unexposed] [sizeof=4] [alignof=4] [offsetof=-2] + } f3; + struct forward_decl f4; + struct x2{ + int g2; + struct forward_decl g3; + } f5; +}; + +// test that fields in incomplete anonymous record do not crash +union f { +//CHECK64: FieldDecl=f1:[[@LINE+1]]:23 (Definition) [type=struct forward_decl] [typekind=Unexposed] [sizeof=-2] [alignof=-2] [offsetof=-2] + struct forward_decl f1; +//CHECK64: FieldDecl=f2:[[@LINE+1]]:7 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=-2] + int f2; + struct { +//CHECK64: FieldDecl=e1:[[@LINE+1]]:9 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=-2] + int e1; + struct { +//CHECK64: FieldDecl=g1:[[@LINE+1]]:28 (Definition) [type=struct forward_decl2] [typekind=Unexposed] [sizeof=-2] [alignof=-2] [offsetof=-2] + struct forward_decl2 g1; + }; +//CHECK64: FieldDecl=e3:[[@LINE+1]]:9 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=-2] + int e3; + }; +}; + + +// incomplete not in root level, in named record +struct s1 { + struct { + struct forward_decl2 s1_g1; +//CHECK64: FieldDecl=s1_e1:[[@LINE+1]]:9 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=-2] + int s1_e1; + } s1_x; // named record shows in s1->field_iterator +//CHECK64: FieldDecl=s1_e3:[[@LINE+1]]:7 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=-2] + int s1_e3; +}; + +// incomplete not in root level, in anonymous record +struct s1b { + struct { + struct forward_decl2 s1b_g1; + }; // erroneous anonymous record does not show in s1b->field_iterator +//CHECK64: FieldDecl=s1b_e2:[[@LINE+1]]:7 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=0] + int s1b_e2; +}; + +struct s2 { + struct { + struct forward_decl2 s2_g1; +//CHECK64: FieldDecl=s2_e1:[[@LINE+1]]:9 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=-5] + int s2_e1; + }; // erroneous anonymous record does not show in s1b->field_iterator +//CHECK64: FieldDecl=s2_e3:[[@LINE+1]]:7 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=0] + int s2_e3; +}; + +//deep anonymous with deep level incomplete +struct s3 { + struct { + int s3_e1; + struct { + struct { + struct { + struct { + struct forward_decl2 s3_g1; + }; + }; + }; + }; +//CHECK64: FieldDecl=s3_e3:[[@LINE+1]]:9 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=64] + int s3_e3; + }; +}; + +//deep anonymous with first level incomplete +struct s4a { + struct forward_decl2 g1; + struct { + struct forward_decl2 g2; + struct { + struct { + struct { + struct { +//CHECK64: FieldDecl=s4_e1:[[@LINE+1]]:17 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=-2] + int s4_e1; + }; + }; + }; + }; +//CHECK64: FieldDecl=s4_e3:[[@LINE+1]]:9 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=-2] + int s4_e3; + }; +}; + +//deep anonymous with sub-first-level incomplete +struct s4b { + struct { + struct forward_decl2 g1; + struct { + struct { + struct { + struct { +//CHECK64: FieldDecl=s4b_e1:[[@LINE+1]]:17 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=-5] + int s4b_e1; + }; + }; + }; + }; +//CHECK64: FieldDecl=s4b_e3:[[@LINE+1]]:9 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=-5] + int s4b_e3; + }; +}; + +// CHECK64: StructDecl=As:[[@LINE+1]]:8 [type=Incomplete::As] [typekind=Record] +struct As; + +// undefined class. Should not crash +// CHECK64: ClassDecl=A:[[@LINE+1]]:7 [type=Incomplete::A] [typekind=Record] +class A; +// CHECK64: ClassDecl=B:[[@LINE+1]]:7 (Definition) [type=Incomplete::B] [typekind=Record] [sizeof=16] [alignof=8] +class B { +// CHECK64: FieldDecl=a1:[[@LINE+2]]:6 (Definition) [type=Incomplete::A *] [typekind=Pointer] [sizeof=8] [alignof=8] [offsetof=0] +// CHECK32: FieldDecl=a1:[[@LINE+1]]:6 (Definition) [type=Incomplete::A *] [typekind=Pointer] [sizeof=4] [alignof=4] [offsetof=0] + A* a1; +// CHECK64: FieldDecl=a2:[[@LINE+2]]:6 (Definition) [type=Incomplete::A &] [typekind=LValueReference] [sizeof=-2] [alignof=-2] [offsetof=64] +// CHECK32: FieldDecl=a2:[[@LINE+1]]:6 (Definition) [type=Incomplete::A &] [typekind=LValueReference] [sizeof=-2] [alignof=-2] [offsetof=32] + A& a2; +}; + +} + +namespace Sizes { + +// CHECK64: StructDecl=A:[[@LINE+2]]:8 (Definition) [type=Sizes::A] [typekind=Record] [sizeof=8] [alignof=4] +// CHECK32: StructDecl=A:[[@LINE+1]]:8 (Definition) [type=Sizes::A] [typekind=Record] [sizeof=8] [alignof=4] +struct A { + int a; + char b; +}; + +// CHECK64: StructDecl=B:[[@LINE+2]]:8 (Definition) [type=Sizes::B] [typekind=Record] [sizeof=12] [alignof=4] +// CHECK32: StructDecl=B:[[@LINE+1]]:8 (Definition) [type=Sizes::B] [typekind=Record] [sizeof=12] [alignof=4] +struct B : A { + char c; +}; + +// CHECK64: StructDecl=C:[[@LINE+2]]:8 (Definition) [type=Sizes::C] [typekind=Record] [sizeof=8] [alignof=4] +// CHECK32: StructDecl=C:[[@LINE+1]]:8 (Definition) [type=Sizes::C] [typekind=Record] [sizeof=8] [alignof=4] +struct C { +// Make fields private so C won't be a POD type. +private: + int a; + char b; +}; + +// CHECK64: StructDecl=D:[[@LINE+2]]:8 (Definition) [type=Sizes::D] [typekind=Record] [sizeof=8] [alignof=4] +// CHECK32: StructDecl=D:[[@LINE+1]]:8 (Definition) [type=Sizes::D] [typekind=Record] [sizeof=8] [alignof=4] +struct D : C { + char c; +}; + +// CHECK64: StructDecl=E:[[@LINE+2]]:32 (Definition) [type=Sizes::E] [typekind=Record] [sizeof=5] [alignof=1] +// CHECK32: StructDecl=E:[[@LINE+1]]:32 (Definition) [type=Sizes::E] [typekind=Record] [sizeof=5] [alignof=1] +struct __attribute__((packed)) E { + char b; + int a; +}; + +// CHECK64: StructDecl=F:[[@LINE+2]]:32 (Definition) [type=Sizes::F] [typekind=Record] [sizeof=6] [alignof=1] +// CHECK32: StructDecl=F:[[@LINE+1]]:32 (Definition) [type=Sizes::F] [typekind=Record] [sizeof=6] [alignof=1] +struct __attribute__((packed)) F : E { + char d; +}; + +struct G { G(); }; +// CHECK64: StructDecl=H:[[@LINE+2]]:8 (Definition) [type=Sizes::H] [typekind=Record] [sizeof=1] [alignof=1] +// CHECK32: StructDecl=H:[[@LINE+1]]:8 (Definition) [type=Sizes::H] [typekind=Record] [sizeof=1] [alignof=1] +struct H : G { }; + +// CHECK64: StructDecl=I:[[@LINE+2]]:8 (Definition) [type=Sizes::I] [typekind=Record] [sizeof=5] [alignof=1] +// CHECK32: StructDecl=I:[[@LINE+1]]:8 (Definition) [type=Sizes::I] [typekind=Record] [sizeof=5] [alignof=1] +struct I { + char b; + int a; +} __attribute__((packed)); + +} + +namespace Test1 { + +// Test complex class hierarchy +struct A { }; +struct B : A { virtual void b(); }; +class C : virtual A { int c; }; +struct D : virtual B { }; +struct E : C, virtual D { }; +class F : virtual E { }; +// CHECK64: StructDecl=G:[[@LINE+2]]:8 (Definition) [type=Test1::G] [typekind=Record] [sizeof=24] [alignof=8] +// CHECK32: StructDecl=G:[[@LINE+1]]:8 (Definition) [type=Test1::G] [typekind=Record] [sizeof=16] [alignof=4] +struct G : virtual E, F { }; + +} + +namespace Test2 { + +// Test that this somewhat complex class structure is laid out correctly. +struct A { }; +struct B : A { virtual void b(); }; +struct C : virtual B { }; +struct D : virtual A { }; +struct E : virtual B, D { }; +struct F : E, virtual C { }; +struct G : virtual F, A { }; +// CHECK64: StructDecl=H:[[@LINE+2]]:8 (Definition) [type=Test2::H] [typekind=Record] [sizeof=24] [alignof=8] +// CHECK32: StructDecl=H:[[@LINE+1]]:8 (Definition) [type=Test2::H] [typekind=Record] [sizeof=12] [alignof=4] +struct H { G g; }; + +} + +namespace Test3 { +// CHECK64: ClassDecl=B:[[@LINE+2]]:7 (Definition) [type=Test3::B] [typekind=Record] [sizeof=16] [alignof=8] +// CHECK32: ClassDecl=B:[[@LINE+1]]:7 (Definition) [type=Test3::B] [typekind=Record] [sizeof=8] [alignof=4] +class B { +public: + virtual void b(){} +// CHECK64: FieldDecl=b_field:[[@LINE+2]]:8 (Definition) [type=long] [typekind=Long] [sizeof=8] [alignof=8] [offsetof=64] +// CHECK32: FieldDecl=b_field:[[@LINE+1]]:8 (Definition) [type=long] [typekind=Long] [sizeof=4] [alignof=4] [offsetof=32] + long b_field; +protected: +private: +}; + +// CHECK32: ClassDecl=A:[[@LINE+1]]:7 (Definition) [type=Test3::A] [typekind=Record] [sizeof=16] [alignof=4] +class A : public B { +public: +// CHECK64: FieldDecl=a_field:[[@LINE+2]]:7 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=128] +// CHECK32: FieldDecl=a_field:[[@LINE+1]]:7 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=64] + int a_field; + virtual void a(){} +// CHECK64: FieldDecl=one:[[@LINE+2]]:8 (Definition) [type=char] [typekind=Char_S] [sizeof=1] [alignof=1] [offsetof=160] +// CHECK32: FieldDecl=one:[[@LINE+1]]:8 (Definition) [type=char] [typekind=Char_S] [sizeof=1] [alignof=1] [offsetof=96] + char one; +protected: +private: +}; + +// CHECK64: ClassDecl=D:[[@LINE+2]]:7 (Definition) [type=Test3::D] [typekind=Record] [sizeof=16] [alignof=8] +// CHECK32: ClassDecl=D:[[@LINE+1]]:7 (Definition) [type=Test3::D] [typekind=Record] [sizeof=12] [alignof=4] +class D { +public: + virtual void b(){} +// CHECK64: FieldDecl=a:[[@LINE+2]]:10 (Definition) [type=double] [typekind=Double] [sizeof=8] [alignof=8] [offsetof=64] +// CHECK32: FieldDecl=a:[[@LINE+1]]:10 (Definition) [type=double] [typekind=Double] [sizeof=8] [alignof=4] [offsetof=32] + double a; +}; + +// CHECK64: ClassDecl=C:[[@LINE+2]]:7 (Definition) [type=Test3::C] [typekind=Record] [sizeof=88] [alignof=8] +// CHECK32: ClassDecl=C:[[@LINE+1]]:7 (Definition) [type=Test3::C] [typekind=Record] [sizeof=60] [alignof=4] +class C : public virtual A, + public D, public B { +public: + double c1_field; + int c2_field; + double c3_field; + int c4_field; + virtual void foo(){} + virtual void bar(){} +protected: +private: +}; + +struct BaseStruct +{ + BaseStruct(){} + double v0; + float v1; +// CHECK64: FieldDecl=fg:[[@LINE+2]]:7 (Definition) [type=Test3::C] [typekind=Record] [sizeof=88] [alignof=8] [offsetof=128] +// CHECK32: FieldDecl=fg:[[@LINE+1]]:7 (Definition) [type=Test3::C] [typekind=Record] [sizeof=60] [alignof=4] [offsetof=96] + C fg; +// CHECK64: FieldDecl=rg:[[@LINE+2]]:8 (Definition) [type=Test3::C &] [typekind=LValueReference] [sizeof=88] [alignof=8] [offsetof=832] +// CHECK32: FieldDecl=rg:[[@LINE+1]]:8 (Definition) [type=Test3::C &] [typekind=LValueReference] [sizeof=60] [alignof=4] [offsetof=576] + C &rg; + int x; +}; + +} + +namespace NotConstantSize { + +void f(int i) { +// CHECK32: VarDecl=v2:[[@LINE+1]]:8 (Definition) [type=int [i]] [typekind=Unexposed] [sizeof=-4] [alignof=4] + int v2[i]; + { + struct CS1 { +// FIXME: should libclang return [offsetof=0] ? +//CHECK32: FieldDecl=f1:[[@LINE+1]]:9 (Definition) [type=int [i]] [typekind=Unexposed] [sizeof=-4] [alignof=4] [offsetof=0] + int f1[i]; +//CHECK32: FieldDecl=f2:[[@LINE+1]]:11 (Definition) [type=float] [typekind=Float] [sizeof=4] [alignof=4] [offsetof=0] + float f2; + }; + } +} + +} + +namespace CrashTest { +// test crash scenarios on dependent types. +template<typename T> +struct Foo { +//CHECK32: FieldDecl=t:[[@LINE+1]]:5 (Definition) [type=T] [typekind=Unexposed] [sizeof=-3] [alignof=-3] [offsetof=-1] + T t; +//CHECK32: FieldDecl=a:[[@LINE+1]]:7 (Definition) [type=int] [typekind=Int] [sizeof=4] [alignof=4] [offsetof=-1] + int a; +}; + +Foo<Sizes::A> t1; +Foo<Sizes::I> t2; + +void c; + +plopplop; + +// CHECK64: StructDecl=lastValid:[[@LINE+2]]:8 (Definition) [type=CrashTest::lastValid] [typekind=Record] [sizeof=1] [alignof=1] +// CHECK32: StructDecl=lastValid:[[@LINE+1]]:8 (Definition) [type=CrashTest::lastValid] [typekind=Record] [sizeof=1] [alignof=1] +struct lastValid { +}; + +} diff --git a/test/Index/print-type.c b/test/Index/print-type.c index 8594994..4805f59 100644 --- a/test/Index/print-type.c +++ b/test/Index/print-type.c @@ -11,12 +11,12 @@ int __attribute__((vector_size(16))) x; typedef int __attribute__((vector_size(16))) int4_t; // 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 *] [Pointer] [void (*)(int)] [Pointer]] [isPOD=0] +// 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] // CHECK: ParmDecl=x:3:22 (Definition) [type=char *] [typekind=Pointer] [isPOD=1] // CHECK: ParmDecl=z:3:33 (Definition) [type=FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] // CHECK: TypeRef=FooType:1:13 [type=FooType] [typekind=Typedef] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] -// CHECK: ParmDecl=arr:3:40 (Definition) [type=int *] [typekind=Pointer] [isPOD=1] +// CHECK: ParmDecl=arr:3:40 (Definition) [type=int [5]] [typekind=ConstantArray] [isPOD=1] // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1] // CHECK: ParmDecl=fn:3:55 (Definition) [type=void (*)(int)] [typekind=Pointer] [canonicaltype=void (*)(int)] [canonicaltypekind=Pointer] [isPOD=1] // CHECK: ParmDecl=:3:62 (Definition) [type=int] [typekind=Int] [isPOD=1] diff --git a/test/Index/print-type.cpp b/test/Index/print-type.cpp index b99d1cb..49a05fb 100644 --- a/test/Index/print-type.cpp +++ b/test/Index/print-type.cpp @@ -26,6 +26,9 @@ struct Bar { template <typename T> T tbar(int); +template <typename T> +T tbar(int[5]); + // RUN: c-index-test -test-print-type %s | FileCheck %s // CHECK: Namespace=outer:1:11 (Definition) [type=] [typekind=Invalid] [isPOD=0] // CHECK: ClassTemplate=Foo:4:8 (Definition) [type=] [typekind=Invalid] [isPOD=0] @@ -59,3 +62,5 @@ T tbar(int); // CHECK: TypedefDecl=ArrayType:20:15 (Definition) [type=ArrayType] [typekind=Typedef] [canonicaltype=int [5]] [canonicaltypekind=ConstantArray] [isPOD=1] // CHECK: FunctionTemplate=tbar:27:3 [type=T (int)] [typekind=FunctionProto] [canonicaltype=type-parameter-0-0 (int)] [canonicaltypekind=FunctionProto] [resulttype=T] [resulttypekind=Unexposed] [isPOD=0] // CHECK: TemplateTypeParameter=T:26:20 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0] +// CHECK: FunctionTemplate=tbar:30:3 [type=T (int *)] [typekind=FunctionProto] [canonicaltype=type-parameter-0-0 (int *)] [canonicaltypekind=FunctionProto] [resulttype=T] [resulttypekind=Unexposed] [isPOD=0] +// CHECK: ParmDecl=:30:11 (Definition) [type=int [5]] [typekind=ConstantArray] [isPOD=1] diff --git a/test/Index/print-type.m b/test/Index/print-type.m index 9325c3f..6f146f8 100644 --- a/test/Index/print-type.m +++ b/test/Index/print-type.m @@ -2,9 +2,14 @@ @property (readonly) id x; -(int) mymethod; -(const id) mymethod2:(id)x blah:(Class)y boo:(SEL)z; +-(bycopy)methodIn:(in int)i andOut:(out short *)j , ...; @end // RUN: c-index-test -test-print-type %s | FileCheck %s -// CHECK: ObjCPropertyDecl=x:2:25 [type=id] [typekind=ObjCId] [canonicaltype=id] [canonicaltypekind=ObjCObjectPointer] [isPOD=1] +// CHECK: ObjCPropertyDecl=x:2:25 [readonly,] [type=id] [typekind=ObjCId] [canonicaltype=id] [canonicaltypekind=ObjCObjectPointer] [isPOD=1] // CHECK: ObjCInstanceMethodDecl=mymethod:3:8 [type=] [typekind=Invalid] [resulttype=int] [resulttypekind=Int] [isPOD=0] // CHECK: ObjCInstanceMethodDecl=mymethod2:blah:boo::4:13 [type=] [typekind=Invalid] [resulttype=const id] [resulttypekind=ObjCId] [args= [id] [ObjCId] [Class] [ObjCClass] [SEL] [ObjCSel]] [isPOD=0] +// CHECK: ParmDecl=z:4:52 (Definition) [type=SEL] [typekind=ObjCSel] [canonicaltype=SEL *] [canonicaltypekind=Pointer] [isPOD=1] +// 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] diff --git a/test/Index/properties-class-extensions.m b/test/Index/properties-class-extensions.m index aa99207..0fa0ecb 100644 --- a/test/Index/properties-class-extensions.m +++ b/test/Index/properties-class-extensions.m @@ -60,12 +60,12 @@ // CHECK: properties-class-extensions.m:9:15: ParmDecl=b:9:15 (Definition) Extent=[9:15 - 9:16] // CHECK: properties-class-extensions.m:10:10: ObjCInstanceMethodDecl=bar:10:10 Extent=[10:1 - 10:14] // CHECK: properties-class-extensions.m:15:12: ObjCInterfaceDecl=Bar:15:12 Extent=[15:1 - 17:5] -// CHECK: properties-class-extensions.m:16:25: ObjCPropertyDecl=bar:16:25 Extent=[16:1 - 16:28] +// CHECK: properties-class-extensions.m:16:25: ObjCPropertyDecl=bar:16:25 [readonly,] Extent=[16:1 - 16:28] // CHECK: properties-class-extensions.m:16:22: TypeRef=id:0:0 Extent=[16:22 - 16:24] // CHECK: properties-class-extensions.m:16:25: ObjCInstanceMethodDecl=bar:16:25 Extent=[16:25 - 16:28] // CHECK: properties-class-extensions.m:18:12: ObjCCategoryDecl=:18:12 Extent=[18:1 - 20:5] // CHECK: properties-class-extensions.m:18:12: ObjCClassRef=Bar:15:12 Extent=[18:12 - 18:15] -// CHECK: properties-class-extensions.m:19:26: ObjCPropertyDecl=bar:19:26 Extent=[19:1 - 19:29] +// CHECK: properties-class-extensions.m:19:26: ObjCPropertyDecl=bar:19:26 [readwrite,] Extent=[19:1 - 19:29] // CHECK: properties-class-extensions.m:19:23: TypeRef=id:0:0 Extent=[19:23 - 19:25] // CHECK-NOT: properties-class-extensions.m:16:25: ObjCInstanceMethodDecl=bar:16:25 Extent=[16:25 - 16:28] // CHECK: properties-class-extensions.m:19:26: ObjCInstanceMethodDecl=setBar::19:26 Extent=[19:26 - 19:29] @@ -73,7 +73,7 @@ // CHECK: properties-class-extensions.m:24:8: ObjCInterfaceDecl=Rdar8467189_Bar:24:8 Extent=[24:1 - 24:23] // CHECK: properties-class-extensions.m:24:8: ObjCClassRef=Rdar8467189_Bar:24:8 Extent=[24:8 - 24:23] // CHECK: properties-class-extensions.m:25:11: ObjCProtocolDecl=Rdar8467189_FooProtocol:25:11 (Definition) Extent=[25:1 - 27:5] -// CHECK: properties-class-extensions.m:26:39: ObjCPropertyDecl=Rdar8467189_Bar:26:39 Extent=[26:1 - 26:54] +// CHECK: properties-class-extensions.m:26:39: ObjCPropertyDecl=Rdar8467189_Bar:26:39 [readonly,] Extent=[26:1 - 26:54] // CHECK: properties-class-extensions.m:26:22: ObjCClassRef=Rdar8467189_Bar:24:8 Extent=[26:22 - 26:37] // CHECK: properties-class-extensions.m:26:39: ObjCInstanceMethodDecl=Rdar8467189_Bar:26:39 Extent=[26:39 - 26:54] // CHECK: properties-class-extensions.m:28:12: ObjCInterfaceDecl=Rdar8467189_Foo:28:12 Extent=[28:1 - 29:5] @@ -82,7 +82,7 @@ // CHECK-NOT: properties-class-extensions.m:31:23: ObjCClassRef=Rdar8467189_Bar:24:8 Extent=[31:23 - 31:38] // CHECK: properties-class-extensions.m:30:12: ObjCCategoryDecl=:30:12 Extent=[30:1 - 32:5] // CHECK: properties-class-extensions.m:30:12: ObjCClassRef=Rdar8467189_Foo:28:12 Extent=[30:12 - 30:27] -// CHECK: properties-class-extensions.m:31:40: ObjCPropertyDecl=Rdar8467189_Bar:31:40 Extent=[31:1 - 31:55] +// CHECK: properties-class-extensions.m:31:40: ObjCPropertyDecl=Rdar8467189_Bar:31:40 [readwrite,] Extent=[31:1 - 31:55] // CHECK: properties-class-extensions.m:31:23: ObjCClassRef=Rdar8467189_Bar:24:8 Extent=[31:23 - 31:38] // CHECK: properties-class-extensions.m:31:40: ObjCInstanceMethodDecl=Rdar8467189_Bar:31:40 [Overrides @26:39] Extent=[31:40 - 31:55] // CHECK: properties-class-extensions.m:31:40: ObjCInstanceMethodDecl=setRdar8467189_Bar::31:40 Extent=[31:40 - 31:55] @@ -90,7 +90,7 @@ // CHECK: properties-class-extensions.m:35:12: ObjCInterfaceDecl=Qux:35:12 Extent=[35:1 - 36:5] // CHECK: properties-class-extensions.m:37:12: ObjCCategoryDecl=:37:12 Extent=[37:1 - 39:5] // CHECK: properties-class-extensions.m:37:12: ObjCClassRef=Qux:35:12 Extent=[37:12 - 37:15] -// CHECK: properties-class-extensions.m:38:34: ObjCPropertyDecl=qux:38:34 Extent=[38:1 - 38:37] +// CHECK: properties-class-extensions.m:38:34: ObjCPropertyDecl=qux:38:34 [assign,readwrite,] Extent=[38:1 - 38:37] // CHECK: properties-class-extensions.m:38:31: TypeRef=id:0:0 Extent=[38:31 - 38:33] // CHECK: properties-class-extensions.m:38:34: ObjCInstanceMethodDecl=qux:38:34 Extent=[38:34 - 38:37] // CHECK: properties-class-extensions.m:38:34: ObjCInstanceMethodDecl=setQux::38:34 Extent=[38:34 - 38:37] diff --git a/test/Index/subclass-comment.mm b/test/Index/subclass-comment.mm new file mode 100644 index 0000000..9682a9f --- /dev/null +++ b/test/Index/subclass-comment.mm @@ -0,0 +1,107 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s > %t/out +// RUN: FileCheck %s < %t/out +// rdar://13647476 + +//! NSObject is root of all. +@interface NSObject +@end +// CHECK: CommentAST=[ +// CHECK-NEXT: (CXComment_FullComment +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ NSObject is root of all.])))] + +//! An umbrella class for super classes. +@interface SuperClass +@end +// CHECK: CommentAST=[ +// CHECK-NEXT: (CXComment_FullComment +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ An umbrella class for super classes.])))] + +@interface SubClass : SuperClass +@end +// CHECK: CommentAST=[ +// CHECK-NEXT: (CXComment_FullComment +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ An umbrella class for super classes.])))] + +@interface SubSubClass : SubClass +@end +// CHECK: CommentAST=[ +// CHECK-NEXT: (CXComment_FullComment +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ An umbrella class for super classes.])))] + +@interface SubSubClass (Private) +@end +// CHECK: CommentAST=[ +// CHECK-NEXT: (CXComment_FullComment +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ An umbrella class for super classes.])))] + +//! Something valuable to the organization. +class Asset { +}; +// CHECK: CommentAST=[ +// CHECK-NEXT: (CXComment_FullComment +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ Something valuable to the organization.])))] + +//! An individual human or human individual. +class Person : public Asset { +}; +// CHECK: CommentAST=[ +// CHECK-NEXT: (CXComment_FullComment +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ An individual human or human individual.])))] + +class Student : public Person { +}; +// CHECK: CommentAST=[ +// CHECK-NEXT: (CXComment_FullComment +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ An individual human or human individual.])))] + +//! Every thing is a part +class Parts { +}; +// CHECK: CommentAST=[ +// CHECK-NEXT: (CXComment_FullComment +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ Every thing is a part])))] + +class Window : public virtual Parts { +}; +// CHECK: CommentAST=[ +// CHECK-NEXT: (CXComment_FullComment +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ Every thing is a part])))] + +class Door : public virtual Parts { +}; +// CHECK: CommentAST=[ +// CHECK-NEXT: (CXComment_FullComment +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ Every thing is a part])))] + +class House : public Window, Door { +}; +// CHECK: CommentAST=[ +// CHECK-NEXT: (CXComment_FullComment +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ Every thing is a part])))] + +//! Any Material +class Material : virtual Parts { +}; + +class Building : Window, public Material { +}; +// CHECK: CommentAST=[ +// CHECK-NEXT: (CXComment_FullComment +// CHECK-NEXT: (CXComment_Paragraph +// CHECK-NEXT: (CXComment_Text Text=[ Any Material])))] + + diff --git a/test/Index/targeted-annotation.c b/test/Index/targeted-annotation.c index cfa1046..022a139 100644 --- a/test/Index/targeted-annotation.c +++ b/test/Index/targeted-annotation.c @@ -82,10 +82,10 @@ int LocalVar2; // TOP: Identifier: "TARGETED_TOP_H" [2:9 - 2:23] preprocessing directive= // TOP: Punctuation: "#" [3:1 - 3:2] preprocessing directive= // TOP: Identifier: "define" [3:2 - 3:8] preprocessing directive= -// TOP: Identifier: "TARGETED_TOP_H" [3:9 - 3:23] preprocessing directive= -// TOP: Punctuation: "#" [5:1 - 5:2] preprocessing directive= -// TOP: Identifier: "include" [5:2 - 5:9] preprocessing directive= -// TOP: Literal: ""targeted-nested1.h"" [5:10 - 5:30] preprocessing directive= +// TOP: Identifier: "TARGETED_TOP_H" [3:9 - 3:23] macro definition=TARGETED_TOP_H +// TOP: Punctuation: "#" [5:1 - 5:2] inclusion directive=targeted-nested1.h +// TOP: Identifier: "include" [5:2 - 5:9] inclusion directive=targeted-nested1.h +// TOP: Literal: ""targeted-nested1.h"" [5:10 - 5:30] inclusion directive=targeted-nested1.h // TOP: Keyword: "enum" [7:1 - 7:5] EnumDecl=:7:1 (Definition) // TOP: Punctuation: "{" [7:6 - 7:7] EnumDecl=:7:1 (Definition) // TOP: Identifier: "VALUE" [8:3 - 8:8] EnumConstantDecl=VALUE:8:3 (Definition) diff --git a/test/Index/usrs.m b/test/Index/usrs.m index be0e323..dccfb75 100644 --- a/test/Index/usrs.m +++ b/test/Index/usrs.m @@ -86,6 +86,7 @@ int test_multi_declaration(void) { id var_ext; } @property (assign) id pro_ext; +-(int)methodWithFn:(void (*)(int *p))fn; @end // RUN: c-index-test -test-load-source-usrs all -target x86_64-apple-macosx10.7 %s | FileCheck %s @@ -146,7 +147,7 @@ int test_multi_declaration(void) { // CHECK: usrs.m c:objc(pl)P1 Extent=[79:1 - 81:5] // CHECK: usrs.m c:objc(pl)P1(im)method Extent=[80:1 - 80:16] // CHECK: usrs.m c:objc(cs)CWithExt2 Extent=[83:1 - 84:5] -// CHECK: usrs.m c:objc(ext)CWithExt2@usrs.m@1111 Extent=[85:1 - 89:5] +// CHECK: usrs.m c:objc(ext)CWithExt2@usrs.m@1111 Extent=[85:1 - 90:5] // CHECK: usrs.m c:objc(cs)CWithExt2@var_ext Extent=[86:3 - 86:13] // CHECK: usrs.m c:objc(cs)CWithExt2(py)pro_ext Extent=[88:1 - 88:30] // CHECK: usrs.m c:objc(cs)CWithExt2(im)pro_ext Extent=[88:23 - 88:30] @@ -279,4 +280,6 @@ int test_multi_declaration(void) { // CHECK-source: usrs.m:76:10: IntegerLiteral= Extent=[76:10 - 76:11] // CHECK-source: usrs.m:79:11: ObjCProtocolDecl=P1:79:11 (Definition) Extent=[79:1 - 81:5] // CHECK-source: usrs.m:80:9: ObjCInstanceMethodDecl=method:80:9 Extent=[80:1 - 80:16] - +// CHECK-source: usrs.m:89:7: ObjCInstanceMethodDecl=methodWithFn::89:7 Extent=[89:1 - 89:41] +// CHECK-source: usrs.m:89:38: ParmDecl=fn:89:38 (Definition) Extent=[89:21 - 89:40] +// CHECK-source: usrs.m:89:35: ParmDecl=p:89:35 (Definition) Extent=[89:30 - 89:36] |