Skip to content

Commit 20cec52

Browse files
evelez7daniel-grumberg
authored andcommitted
[clang][ExtractAPI] Add semicolons to vars and fields and to test reference JSON
Differential Revision: https://reviews.llvm.org/D154038
1 parent 91cd37b commit 20cec52

File tree

6 files changed

+38
-1
lines changed

6 files changed

+38
-1
lines changed

clang/lib/ExtractAPI/DeclarationFragments.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,8 @@ DeclarationFragmentsBuilder::getFragmentsForField(const FieldDecl *Field) {
606606
return getFragmentsForType(Field->getType(), Field->getASTContext(), After)
607607
.appendSpace()
608608
.append(Field->getName(), DeclarationFragments::FragmentKind::Identifier)
609-
.append(std::move(After));
609+
.append(std::move(After))
610+
.append(";", DeclarationFragments::FragmentKind::Text);
610611
}
611612

612613
DeclarationFragments

clang/test/ExtractAPI/anonymous_record_no_typedef.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@ struct Vehicle {
316316
{
317317
"kind": "identifier",
318318
"spelling": "type"
319+
},
320+
{
321+
"kind": "text",
322+
"spelling": ";"
319323
}
320324
],
321325
"identifier": {
@@ -367,6 +371,10 @@ struct Vehicle {
367371
{
368372
"kind": "identifier",
369373
"spelling": "information"
374+
},
375+
{
376+
"kind": "text",
377+
"spelling": ";"
370378
}
371379
],
372380
"identifier": {

clang/test/ExtractAPI/objc_interface.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,10 @@ - (char)getIvar;
583583
{
584584
"kind": "identifier",
585585
"spelling": "Ivar"
586+
},
587+
{
588+
"kind": "text",
589+
"spelling": ";"
586590
}
587591
],
588592
"identifier": {

clang/test/ExtractAPI/struct.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ struct Color {
161161
{
162162
"kind": "identifier",
163163
"spelling": "Red"
164+
},
165+
{
166+
"kind": "text",
167+
"spelling": ";"
164168
}
165169
],
166170
"identifier": {
@@ -213,6 +217,10 @@ struct Color {
213217
{
214218
"kind": "identifier",
215219
"spelling": "Green"
220+
},
221+
{
222+
"kind": "text",
223+
"spelling": ";"
216224
}
217225
],
218226
"identifier": {
@@ -265,6 +273,10 @@ struct Color {
265273
{
266274
"kind": "identifier",
267275
"spelling": "Blue"
276+
},
277+
{
278+
"kind": "text",
279+
"spelling": ";"
268280
}
269281
],
270282
"identifier": {
@@ -317,6 +329,10 @@ struct Color {
317329
{
318330
"kind": "identifier",
319331
"spelling": "Alpha"
332+
},
333+
{
334+
"kind": "text",
335+
"spelling": ";"
320336
}
321337
],
322338
"docComment": {

clang/test/ExtractAPI/typedef_struct_enum.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ struct Foo {
328328
{
329329
"kind": "identifier",
330330
"spelling": "bar"
331+
},
332+
{
333+
"kind": "text",
334+
"spelling": ";"
331335
}
332336
],
333337
"identifier": {

clang/test/ExtractAPI/underscored.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ typedef _HiddenTypedef ExposedTypedefToHidden;
194194
{
195195
"kind": "identifier",
196196
"spelling": "a"
197+
},
198+
{
199+
"kind": "text",
200+
"spelling": ";"
197201
}
198202
],
199203
"identifier": {

0 commit comments

Comments
 (0)