1// RUN: rm -rf %t
2// RUN: mkdir %t
3// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s > %t/out
4// RUN: FileCheck %s < %t/out
5// rdar://13067629
6
7// Ensure that XML we generate is not invalid.
8// RUN: FileCheck %s -check-prefix=WRONG < %t/out
9// WRONG-NOT: CommentXMLInvalid
10
11// rdar://12397511
12
13/*!
14     \headerfile Device.h <Foundation/Device.h>
15
16      A Device represents a remote or local computer or device with which the Developer Tools can interact.  Each Device supports blah blah blah from doing blah blah blah.
17*/
18@interface Device
19@end
20// CHECK: headerfile-comment-to-html.m:[[@LINE-2]]:12: ObjCInterfaceDecl=Device:{{.*}} FullCommentAsXML=[<Other file="{{[^"]+}}headerfile-comment-to-html.m" line="[[@LINE-2]]" column="12"><Name>Device</Name><USR>c:objc(cs)Device</USR><Headerfile><Para> Device.h &lt;Foundation/Device.h&gt;</Para></Headerfile><Declaration>@interface Device\n@end</Declaration><Abstract><Para>      A Device represents a remote or local computer or device with which the Developer Tools can interact.  Each Device supports blah blah blah from doing blah blah blah.</Para></Abstract></Other>]
21// CHECK-NEXT:  CommentAST=[
22// CHECK-NEXT:    (CXComment_FullComment
23// CHECK-NEXT:       (CXComment_Paragraph IsWhitespace
24// CHECK-NEXT:         (CXComment_Text Text=[     ] IsWhitespace))
25// CHECK-NEXT:       (CXComment_BlockCommand CommandName=[headerfile]
26// CHECK-NEXT:         (CXComment_Paragraph
27// CHECK-NEXT:           (CXComment_Text Text=[ Device.h ])
28// CHECK-NEXT:           (CXComment_Text Text=[<Foundation])
29// CHECK-NEXT:           (CXComment_Text Text=[/Device.h>])))
30// CHECK-NEXT:       (CXComment_Paragraph
31// CHECK-NEXT:         (CXComment_Text Text=[      A Device represents a remote or local computer or device with which the Developer Tools can interact.  Each Device supports blah blah blah from doing blah blah blah.])))]
32
33/*!
34    \headerfile Sensor.h "Sensor.h"
35
36    \brief This is Sensor on the Device.
37    Its purpose is not to Sense Device's heat.
38*/
39
40@interface Sensor
41@end
42// CHECK: headerfile-comment-to-html.m:[[@LINE-2]]:12: ObjCInterfaceDecl=Sensor:{{.*}} FullCommentAsXML=[<Other file="{{[^"]+}}headerfile-comment-to-html.m" line="[[@LINE-2]]" column="12"><Name>Sensor</Name><USR>c:objc(cs)Sensor</USR><Headerfile><Para> Sensor.h &quot;Sensor.h&quot;</Para></Headerfile><Declaration>@interface Sensor\n@end</Declaration><Abstract><Para> This is Sensor on the Device.    Its purpose is not to Sense Device&apos;s heat.</Para></Abstract></Other>]
43// CHECK-NEXT:  CommentAST=[
44// CHECK-NEXT:    (CXComment_FullComment
45// CHECK-NEXT:       (CXComment_Paragraph IsWhitespace
46// CHECK-NEXT:         (CXComment_Text Text=[    ] IsWhitespace))
47// CHECK-NEXT:       (CXComment_BlockCommand CommandName=[headerfile]
48// CHECK-NEXT:         (CXComment_Paragraph
49// CHECK-NEXT:           (CXComment_Text Text=[ Sensor.h "Sensor.h"])))
50// CHECK-NEXT:       (CXComment_Paragraph IsWhitespace
51// CHECK-NEXT:         (CXComment_Text Text=[    ] IsWhitespace))
52// CHECK-NEXT:       (CXComment_BlockCommand CommandName=[brief]
53// CHECK-NEXT:         (CXComment_Paragraph
54// CHECK-NEXT:           (CXComment_Text Text=[ This is Sensor on the Device.] HasTrailingNewline)
55// CHECK-NEXT:           (CXComment_Text Text=[    Its purpose is not to Sense Device's heat.]))))]
56
57/*!
58    \brief Test that headerfile can come after brief.
59    \headerfile VTDevice.h <VTFoundation/VTDevice.h>
60
61    More property decription goes here.
62*/
63@interface VTDevice : Device
64@end
65// CHECK: headerfile-comment-to-html.m:[[@LINE-2]]:12: ObjCInterfaceDecl=VTDevice:{{.*}} FullCommentAsXML=[<Other file="{{[^"]+}}headerfile-comment-to-html.m" line="[[@LINE-2]]" column="12"><Name>VTDevice</Name><USR>c:objc(cs)VTDevice</USR><Headerfile><Para> VTDevice.h &lt;VTFoundation/VTDevice.h&gt;</Para></Headerfile><Declaration>@interface VTDevice : Device\n@end</Declaration><Abstract><Para> Test that headerfile can come after brief.    </Para></Abstract><Discussion><Para>    More property decription goes here.</Para></Discussion></Other>]
66// CHECK-NEXT:  CommentAST=[
67// CHECK-NEXT:    (CXComment_FullComment
68// CHECK-NEXT:       (CXComment_Paragraph IsWhitespace
69// CHECK-NEXT:         (CXComment_Text Text=[    ] IsWhitespace))
70// CHECK-NEXT:       (CXComment_BlockCommand CommandName=[brief]
71// CHECK-NEXT:         (CXComment_Paragraph
72// CHECK-NEXT:           (CXComment_Text Text=[ Test that headerfile can come after brief.] HasTrailingNewline)
73// CHECK-NEXT:           (CXComment_Text Text=[    ] IsWhitespace)))
74// CHECK-NEXT:       (CXComment_BlockCommand CommandName=[headerfile]
75// CHECK-NEXT:         (CXComment_Paragraph
76// CHECK-NEXT:           (CXComment_Text Text=[ VTDevice.h ])
77// CHECK-NEXT:           (CXComment_Text Text=[<VTFoundation])
78// CHECK-NEXT:           (CXComment_Text Text=[/VTDevice.h>])))
79// CHECK-NEXT:       (CXComment_Paragraph
80// CHECK-NEXT:         (CXComment_Text Text=[    More property decription goes here.])))]
81
82/*!
83  \headerfile  <stdio.h>
84*/
85extern void uses_stdio_h();
86// CHECK: headerfile-comment-to-html.m:[[@LINE-1]]:13: FunctionDecl=uses_stdio_h:{{.*}} FullCommentAsXML=[<Function file="{{[^"]+}}headerfile-comment-to-html.m" line="[[@LINE-1]]" column="13"><Name>uses_stdio_h</Name><USR>c:@F@uses_stdio_h</USR><Headerfile><Para>  &lt;stdio.h&gt;</Para></Headerfile><Declaration>extern void uses_stdio_h()</Declaration></Function>]
87// CHECK-NEXT:  CommentAST=[
88// CHECK-NEXT:    (CXComment_FullComment
89// CHECK-NEXT:       (CXComment_Paragraph IsWhitespace
90// CHECK-NEXT:         (CXComment_Text Text=[  ] IsWhitespace))
91// CHECK-NEXT:       (CXComment_BlockCommand CommandName=[headerfile]
92// CHECK-NEXT:         (CXComment_Paragraph
93// CHECK-NEXT:           (CXComment_Text Text=[  ] IsWhitespace)
94// CHECK-NEXT:           (CXComment_Text Text=[<stdio])
95// CHECK-NEXT:           (CXComment_Text Text=[.h>]))))]
96
97
98/*!
99  \headerfile  <algorithm>
100*/
101extern void uses_argorithm();
102// CHECK: headerfile-comment-to-html.m:[[@LINE-1]]:13: FunctionDecl=uses_argorithm:{{.*}} FullCommentAsXML=[<Function file="{{[^"]+}}headerfile-comment-to-html.m" line="[[@LINE-1]]" column="13"><Name>uses_argorithm</Name><USR>c:@F@uses_argorithm</USR><Headerfile><Para>  &lt;algorithm&gt;</Para></Headerfile><Declaration>extern void uses_argorithm()</Declaration></Function>]
103// CHECK-NEXT:  CommentAST=[
104// CHECK-NEXT:    (CXComment_FullComment
105// CHECK-NEXT:       (CXComment_Paragraph IsWhitespace
106// CHECK-NEXT:         (CXComment_Text Text=[  ] IsWhitespace))
107// CHECK-NEXT:       (CXComment_BlockCommand CommandName=[headerfile]
108// CHECK-NEXT:         (CXComment_Paragraph
109// CHECK-NEXT:           (CXComment_Text Text=[  ] IsWhitespace)
110// CHECK-NEXT:           (CXComment_Text Text=[<algorithm])
111// CHECK-NEXT:           (CXComment_Text Text=[>]))))]
112