[clang][ExtractAPI] Fix appendSpace in DeclarationFragments
There is a bug in `DeclarationFragments::appendSpace` where the space character is added to a local copy of the last fragment. Differential Revision: https://reviews.llvm.org/D123259
This commit is contained in:
parent
82662b753d
commit
fe2c77a006
|
@ -21,7 +21,7 @@ using namespace llvm;
|
|||
|
||||
DeclarationFragments &DeclarationFragments::appendSpace() {
|
||||
if (!Fragments.empty()) {
|
||||
Fragment Last = Fragments.back();
|
||||
Fragment &Last = Fragments.back();
|
||||
if (Last.Kind == FragmentKind::Text) {
|
||||
// Merge the extra space into the last fragment if the last fragment is
|
||||
// also text.
|
||||
|
@ -390,7 +390,7 @@ DeclarationFragmentsBuilder::getFragmentsForParam(const ParmVarDecl *Param) {
|
|||
if (Param->isObjCMethodParameter())
|
||||
Fragments.append("(", DeclarationFragments::FragmentKind::Text)
|
||||
.append(std::move(TypeFragments))
|
||||
.append(")", DeclarationFragments::FragmentKind::Text);
|
||||
.append(") ", DeclarationFragments::FragmentKind::Text);
|
||||
else
|
||||
Fragments.append(std::move(TypeFragments)).appendSpace();
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ char unavailable __attribute__((unavailable));
|
|||
},
|
||||
{
|
||||
"kind": "text",
|
||||
"spelling": " *"
|
||||
"spelling": " * "
|
||||
},
|
||||
{
|
||||
"kind": "internalParam",
|
||||
|
@ -331,7 +331,7 @@ char unavailable __attribute__((unavailable));
|
|||
},
|
||||
{
|
||||
"kind": "text",
|
||||
"spelling": " *"
|
||||
"spelling": " * "
|
||||
},
|
||||
{
|
||||
"kind": "internalParam",
|
||||
|
|
|
@ -177,7 +177,7 @@ char unavailable __attribute__((unavailable));
|
|||
},
|
||||
{
|
||||
"kind": "text",
|
||||
"spelling": " *"
|
||||
"spelling": " * "
|
||||
},
|
||||
{
|
||||
"kind": "internalParam",
|
||||
|
@ -333,7 +333,7 @@ char unavailable __attribute__((unavailable));
|
|||
},
|
||||
{
|
||||
"kind": "text",
|
||||
"spelling": " *"
|
||||
"spelling": " * "
|
||||
},
|
||||
{
|
||||
"kind": "internalParam",
|
||||
|
|
|
@ -142,7 +142,7 @@ FUNC_GEN(bar, const int *, unsigned);
|
|||
},
|
||||
{
|
||||
"kind": "text",
|
||||
"spelling": " *"
|
||||
"spelling": " * "
|
||||
},
|
||||
{
|
||||
"kind": "internalParam",
|
||||
|
@ -189,7 +189,7 @@ FUNC_GEN(bar, const int *, unsigned);
|
|||
},
|
||||
{
|
||||
"kind": "text",
|
||||
"spelling": " *"
|
||||
"spelling": " * "
|
||||
},
|
||||
{
|
||||
"kind": "internalParam",
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
},
|
||||
{
|
||||
"kind": "text",
|
||||
"spelling": ")"
|
||||
"spelling": ") "
|
||||
},
|
||||
{
|
||||
"kind": "identifier",
|
||||
|
@ -185,7 +185,7 @@
|
|||
},
|
||||
{
|
||||
"kind": "text",
|
||||
"spelling": ")"
|
||||
"spelling": ") "
|
||||
},
|
||||
{
|
||||
"kind": "identifier",
|
||||
|
@ -266,7 +266,7 @@
|
|||
},
|
||||
{
|
||||
"kind": "text",
|
||||
"spelling": ")"
|
||||
"spelling": ") "
|
||||
},
|
||||
{
|
||||
"kind": "typeIdentifier",
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
},
|
||||
{
|
||||
"kind": "text",
|
||||
"spelling": ")"
|
||||
"spelling": ") "
|
||||
},
|
||||
{
|
||||
"kind": "identifier",
|
||||
|
@ -163,7 +163,7 @@
|
|||
},
|
||||
{
|
||||
"kind": "text",
|
||||
"spelling": ")"
|
||||
"spelling": ") "
|
||||
},
|
||||
{
|
||||
"kind": "internalParam",
|
||||
|
@ -244,7 +244,7 @@
|
|||
},
|
||||
{
|
||||
"kind": "text",
|
||||
"spelling": ")"
|
||||
"spelling": ") "
|
||||
},
|
||||
{
|
||||
"kind": "typeIdentifier",
|
||||
|
@ -398,7 +398,7 @@
|
|||
},
|
||||
{
|
||||
"kind": "text",
|
||||
"spelling": ")"
|
||||
"spelling": ") "
|
||||
},
|
||||
{
|
||||
"kind": "identifier",
|
||||
|
|
Loading…
Reference in a new issue