[clang][ExtractAPI] Add semicolons to vars and fields and to test reference JSON

Differential Revision: https://reviews.llvm.org/D154038
This commit is contained in:
Erick Velez 2023-06-26 15:01:30 -07:00
parent 8d359b2472
commit 422bcd10c4
11 changed files with 72 additions and 2 deletions

View File

@ -389,7 +389,8 @@ DeclarationFragmentsBuilder::getFragmentsForVar(const VarDecl *Var) {
return Fragments.append(getFragmentsForType(T, Var->getASTContext(), After))
.appendSpace()
.append(Var->getName(), DeclarationFragments::FragmentKind::Identifier)
.append(std::move(After));
.append(std::move(After))
.append(";", DeclarationFragments::FragmentKind::Text);
}
DeclarationFragments
@ -495,7 +496,8 @@ DeclarationFragmentsBuilder::getFragmentsForField(const FieldDecl *Field) {
return getFragmentsForType(Field->getType(), Field->getASTContext(), After)
.appendSpace()
.append(Field->getName(), DeclarationFragments::FragmentKind::Identifier)
.append(std::move(After));
.append(std::move(After))
.append(";", DeclarationFragments::FragmentKind::Text);
}
DeclarationFragments

View File

@ -316,6 +316,10 @@ struct Vehicle {
{
"kind": "identifier",
"spelling": "type"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {
@ -367,6 +371,10 @@ struct Vehicle {
{
"kind": "identifier",
"spelling": "information"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {

View File

@ -68,6 +68,10 @@ char unavailable __attribute__((unavailable));
{
"kind": "identifier",
"spelling": "num"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {

View File

@ -70,6 +70,10 @@ char unavailable __attribute__((unavailable));
{
"kind": "identifier",
"spelling": "num"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {

View File

@ -66,6 +66,10 @@ struct Foo { int a; };
{
"kind": "identifier",
"spelling": "num"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {

View File

@ -70,6 +70,10 @@ char objc;
{
"kind": "identifier",
"spelling": "c"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {
@ -150,6 +154,10 @@ char objc;
{
"kind": "identifier",
"spelling": "objc"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {

View File

@ -579,6 +579,10 @@
{
"kind": "identifier",
"spelling": "Ivar"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {

View File

@ -102,6 +102,10 @@ int OtherInt;
{
"kind": "identifier",
"spelling": "MyInt"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {
@ -153,6 +157,10 @@ int OtherInt;
{
"kind": "identifier",
"spelling": "MyChar"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {

View File

@ -161,6 +161,10 @@ struct Color {
{
"kind": "identifier",
"spelling": "Red"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {
@ -213,6 +217,10 @@ struct Color {
{
"kind": "identifier",
"spelling": "Green"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {
@ -265,6 +273,10 @@ struct Color {
{
"kind": "identifier",
"spelling": "Blue"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {
@ -317,6 +329,10 @@ struct Color {
{
"kind": "identifier",
"spelling": "Alpha"
},
{
"kind": "text",
"spelling": ";"
}
],
"docComment": {

View File

@ -328,6 +328,10 @@ struct Foo {
{
"kind": "identifier",
"spelling": "bar"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {

View File

@ -85,6 +85,10 @@ typedef _HiddenTypedef ExposedTypedefToHidden;
{
"kind": "identifier",
"spelling": "exposed_global"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {
@ -190,6 +194,10 @@ typedef _HiddenTypedef ExposedTypedefToHidden;
{
"kind": "identifier",
"spelling": "a"
},
{
"kind": "text",
"spelling": ";"
}
],
"identifier": {