Skip to content

Commit 6dc63e2

Browse files
committed
Revert "Merge pull request swiftlang#27190 from compnerd/27132"
This reverts commit 4838791, reversing changes made to 4c3f044.
1 parent 362b219 commit 6dc63e2

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

include/swift/Parse/SyntaxParsingContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ class alignas(1 << SyntaxAlignInBits) SyntaxParsingContext {
300300
return SyntaxNode(std::move(rawNode));
301301
}
302302

303-
ParsedTokenSyntax &&popToken();
303+
ParsedTokenSyntax popToken();
304304

305305
/// Create a node using the tail of the collected parts. The number of parts
306306
/// is automatically determined from \c Kind. Node: limited number of \c Kind

lib/Parse/ParseType.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ Parser::TypeASTResult Parser::parseType(Diag<> MessageID,
408408
}
409409

410410
if (Tok.is(tok::arrow)) {
411-
auto InputNode(std::move(SyntaxContext->popIf<ParsedTypeSyntax>().getValue()));
411+
auto InputNode = SyntaxContext->popIf<ParsedTypeSyntax>().getValue();
412412
// Handle type-function if we have an arrow.
413413
auto ArrowLoc = Tok.getLoc();
414414
auto Arrow = consumeTokenSyntax();
@@ -741,7 +741,7 @@ Parser::TypeResult Parser::parseTypeIdentifier() {
741741
if (Base) {
742742
SyntaxContext->addSyntax(std::move(*Base));
743743
auto T = SyntaxContext->topNode<TypeSyntax>();
744-
Junk.push_back(std::move(*SyntaxContext->popIf<ParsedTypeSyntax>()));
744+
Junk.push_back(*SyntaxContext->popIf<ParsedTypeSyntax>());
745745
ITR = dyn_cast<IdentTypeRepr>(Generator.generate(T, BaseLoc));
746746
}
747747

@@ -1164,10 +1164,9 @@ Parser::TypeResult Parser::parseTypeTupleBody() {
11641164
auto InFlight = diagnose(EqualLoc, diag::tuple_type_init);
11651165
if (Init.isNonNull())
11661166
InFlight.fixItRemove(SourceRange(EqualLoc, Init.get()->getEndLoc()));
1167+
auto Expr = *SyntaxContext->popIf<ParsedExprSyntax>();
11671168
Initializer = ParsedSyntaxRecorder::makeInitializerClause(
1168-
std::move(*Equal),
1169-
std::move(*SyntaxContext->popIf<ParsedExprSyntax>()),
1170-
*SyntaxContext);
1169+
std::move(*Equal), std::move(Expr), *SyntaxContext);
11711170
}
11721171

11731172
Comma = consumeTokenSyntaxIf(tok::comma);

lib/Parse/SyntaxParsingContext.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ const SyntaxParsingContext *SyntaxParsingContext::getRoot() const {
163163
return Curr;
164164
}
165165

166-
ParsedTokenSyntax &&SyntaxParsingContext::popToken() {
167-
return std::move(popIf<ParsedTokenSyntax>().getValue());
166+
ParsedTokenSyntax SyntaxParsingContext::popToken() {
167+
return popIf<ParsedTokenSyntax>().getValue();
168168
}
169169

170170
/// Add Token with Trivia to the parts.
@@ -342,7 +342,7 @@ SyntaxParsingContext::~SyntaxParsingContext() {
342342
Storage.push_back(std::move(BridgedNode.getValue()));
343343
}
344344
} else {
345-
auto node(std::move(bridgeAs(CtxtKind, getParts()).getValue()));
345+
auto node = bridgeAs(CtxtKind, getParts()).getValue();
346346
Storage.erase(Storage.begin() + Offset, Storage.end());
347347
Storage.emplace_back(std::move(node));
348348
}

0 commit comments

Comments
 (0)