File tree 3 files changed +60
-0
lines changed
3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change 46
46
<optional >
47
47
<ref name =" ResultDiscussion" />
48
48
</optional >
49
+ <optional >
50
+ <ref name =" Tags" />
51
+ </optional >
49
52
<optional >
50
53
<ref name =" Discussion" />
51
54
</optional >
115
118
<optional >
116
119
<ref name =" ResultDiscussion" />
117
120
</optional >
121
+ <optional >
122
+ <ref name =" Tags" />
123
+ </optional >
118
124
<optional >
119
125
<ref name =" Discussion" />
120
126
</optional >
166
172
<optional >
167
173
<ref name =" ResultDiscussion" />
168
174
</optional >
175
+ <optional >
176
+ <ref name =" Tags" />
177
+ </optional >
169
178
170
179
<optional >
171
180
<ref name =" Discussion" />
209
218
<optional >
210
219
<ref name =" ResultDiscussion" />
211
220
</optional >
221
+ <optional >
222
+ <ref name =" Tags" />
223
+ </optional >
212
224
213
225
<optional >
214
226
<ref name =" Discussion" />
252
264
<optional >
253
265
<ref name =" ResultDiscussion" />
254
266
</optional >
267
+ <optional >
268
+ <ref name =" Tags" />
269
+ </optional >
255
270
256
271
<optional >
257
272
<ref name =" Discussion" />
294
309
<optional >
295
310
<ref name =" ResultDiscussion" />
296
311
</optional >
312
+ <optional >
313
+ <ref name =" Tags" />
314
+ </optional >
297
315
298
316
<optional >
299
317
<ref name =" Discussion" />
337
355
<optional >
338
356
<ref name =" ResultDiscussion" />
339
357
</optional >
358
+ <optional >
359
+ <ref name =" Tags" />
360
+ </optional >
340
361
341
362
<optional >
342
363
<ref name =" Discussion" />
640
661
</element >
641
662
</define >
642
663
664
+ <define name =" Tags" >
665
+ <element name =" Tags" >
666
+ <oneOrMore >
667
+ <element name =" Tag" >
668
+ <data type =" string" />
669
+ </element >
670
+ </oneOrMore >
671
+ </element >
672
+ </define >
673
+
643
674
<define name =" Parameters" >
644
675
<element name =" Parameters" >
645
676
<!-- Parameter elements should be sorted according to index. -->
Original file line number Diff line number Diff line change @@ -245,6 +245,19 @@ struct CommentToXMLConverter {
245
245
OS << " </ThrowsDiscussion>" ;
246
246
}
247
247
248
+ void printTagFields (ArrayRef<StringRef> Tags) {
249
+ OS << " <Tags>" ;
250
+ for (const auto Tag : Tags) {
251
+ if (Tag.empty ()) {
252
+ continue ;
253
+ }
254
+ OS << " <Tag>" ;
255
+ appendWithXMLEscaping (OS, Tag);
256
+ OS << " </Tag>" ;
257
+ }
258
+ OS << " </Tags>" ;
259
+ }
260
+
248
261
void visitDocComment (const DocComment *DC);
249
262
void visitCommentParts (const swift::markup::CommentParts &Parts);
250
263
};
@@ -271,6 +284,10 @@ void CommentToXMLConverter::visitCommentParts(const swift::markup::CommentParts
271
284
if (Parts.ThrowsField .hasValue ())
272
285
printThrowsDiscussion (Parts.ThrowsField .getValue ());
273
286
287
+ if (!Parts.Tags .empty ()) {
288
+ printTagFields (Parts.Tags );
289
+ }
290
+
274
291
if (!Parts.BodyNodes .empty ()) {
275
292
OS << " <Discussion>" ;
276
293
for (const auto *N : Parts.BodyNodes )
Original file line number Diff line number Diff line change @@ -477,3 +477,15 @@ public func localizationKeyShouldNotAppearInDocComments() {}
477
477
/// - LocalizationKey: ABC
478
478
public func localizationKeyShouldNotAppearInDocComments2( ) { }
479
479
// CHECK: DocCommentAsXML=[<Function file="{{.*}}" line="{{.*}}" column="{{.*}}"><Name>localizationKeyShouldNotAppearInDocComments2()</Name><USR>s:14comment_to_xml44localizationKeyShouldNotAppearInDocComments2yyF</USR><Declaration>public func localizationKeyShouldNotAppearInDocComments2()</Declaration><CommentParts></CommentParts></Function>]
480
+
481
+ /// Brief.
482
+ ///
483
+ /// - Tag:
484
+ /// - Tag:
485
+ /// - Tag: Tag_A
486
+ /// - Tag: Tag B
487
+ /// - Tag: Dedupe tag
488
+ /// - Tag: Dedupe tag
489
+ /// - TAG: TAG_C
490
+ public func tags( ) { }
491
+ // CHECK: DocCommentAsXML=[<Function file="{{.*}}" line="{{.*}}" column="{{.*}}"><Name>tags()</Name><USR>s:14comment_to_xml4tagsyyF</USR><Declaration>public func tags()</Declaration><CommentParts><Abstract><Para>Brief.</Para></Abstract><Tags><Tag>Tag_A</Tag><Tag>Tag B</Tag><Tag>Dedupe tag</Tag><Tag>TAG_C</Tag></Tags></CommentParts></Function>]
You can’t perform that action at this time.
0 commit comments