Remove unnecessary and RVO-detrimental moves

This commit is contained in:
Jack Andersen 2016-10-02 18:39:10 -10:00
parent 3a44ef11a4
commit d307e645b1
2 changed files with 9 additions and 9 deletions

View File

@ -168,8 +168,8 @@ void Lexer::consumeAllTokens(Parser& parser)
m_diag.reportLexerErr(n->m_next->m_tok.m_location, "empty function arg"); m_diag.reportLexerErr(n->m_next->m_tok.m_location, "empty function arg");
return; return;
} }
m_pool.emplace_front(std::move( m_pool.emplace_front(
Parser::Token(Parser::TokenType::EvalGroupStart, n->m_next->m_tok.m_location))); Parser::Token(Parser::TokenType::EvalGroupStart, n->m_next->m_tok.m_location));
Lexer::OperationNode* grp = &m_pool.front(); Lexer::OperationNode* grp = &m_pool.front();
grp->m_next = n->m_next; grp->m_next = n->m_next;
grp->m_prev = n; grp->m_prev = n;
@ -181,8 +181,8 @@ void Lexer::consumeAllTokens(Parser& parser)
{ {
if (n->m_prev->m_tok.m_type != Parser::TokenType::FunctionStart) if (n->m_prev->m_tok.m_type != Parser::TokenType::FunctionStart)
{ {
m_pool.emplace_front(std::move( m_pool.emplace_front(
Parser::Token(Parser::TokenType::EvalGroupEnd, n->m_tok.m_location))); Parser::Token(Parser::TokenType::EvalGroupEnd, n->m_tok.m_location));
Lexer::OperationNode* grp = &m_pool.front(); Lexer::OperationNode* grp = &m_pool.front();
grp->m_next = n; grp->m_next = n;
grp->m_prev = n->m_prev; grp->m_prev = n->m_prev;
@ -199,12 +199,12 @@ void Lexer::consumeAllTokens(Parser& parser)
return; return;
} }
m_pool.emplace_front(std::move( m_pool.emplace_front(
Parser::Token(Parser::TokenType::EvalGroupEnd, n->m_tok.m_location))); Parser::Token(Parser::TokenType::EvalGroupEnd, n->m_tok.m_location));
Lexer::OperationNode* egrp = &m_pool.front(); Lexer::OperationNode* egrp = &m_pool.front();
m_pool.emplace_front(std::move( m_pool.emplace_front(
Parser::Token(Parser::TokenType::EvalGroupStart, n->m_next->m_tok.m_location))); Parser::Token(Parser::TokenType::EvalGroupStart, n->m_next->m_tok.m_location));
Lexer::OperationNode* sgrp = &m_pool.front(); Lexer::OperationNode* sgrp = &m_pool.front();
egrp->m_next = sgrp; egrp->m_next = sgrp;

View File

@ -334,7 +334,7 @@ hecl::DirectoryEnumerator::DirectoryEnumerator(const hecl::SystemChar* path, Mod
else else
continue; continue;
m_entries.push_back(std::move(Entry(std::move(fp), d->d_name, sz, isDir))); m_entries.push_back(Entry(std::move(fp), d->d_name, sz, isDir));
} }
break; break;
case Mode::DirsThenFilesSorted: case Mode::DirsThenFilesSorted: