mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 11:32:03 +00:00
Reduce shared_ptr copies
This commit is contained in:
parent
95bd7eec67
commit
1aa6266c56
@ -46,16 +46,15 @@ bool ParserList::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
|||||||
if (!elem_parser->parse(pos, element, expected))
|
if (!elem_parser->parse(pos, element, expected))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
elements.push_back(element);
|
elements.push_back(std::move(element));
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!parseUtil(pos, expected, parse_element, *separator_parser, allow_empty))
|
if (!parseUtil(pos, expected, parse_element, *separator_parser, allow_empty))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto list = std::make_shared<ASTExpressionList>(result_separator);
|
node = std::make_shared<ASTExpressionList>(result_separator);
|
||||||
list->children = std::move(elements);
|
node->children = std::move(elements);
|
||||||
node = list;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -76,7 +75,7 @@ bool ParserUnionList::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
|||||||
if (!elem_parser.parse(pos, element, expected))
|
if (!elem_parser.parse(pos, element, expected))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
elements.push_back(element);
|
elements.push_back(std::move(element));
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -120,9 +119,8 @@ bool ParserUnionList::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
|||||||
if (!parseUtil(pos, parse_element, parse_separator))
|
if (!parseUtil(pos, parse_element, parse_separator))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto list = std::make_shared<ASTExpressionList>();
|
node = std::make_shared<ASTExpressionList>();
|
||||||
list->children = std::move(elements);
|
node->children = std::move(elements);
|
||||||
node = list;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +240,7 @@ bool ParserLeftAssociativeBinaryOperatorList::parseImpl(Pos & pos, ASTPtr & node
|
|||||||
if (!elem_parser->parse(pos, elem, expected))
|
if (!elem_parser->parse(pos, elem, expected))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
node = elem;
|
node = std::move(elem);
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1398,7 +1396,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto subquery = std::make_shared<ASTSubquery>();
|
auto subquery = std::make_shared<ASTSubquery>();
|
||||||
subquery->children.push_back(node);
|
subquery->children.push_back(std::move(node));
|
||||||
elements = {makeASTFunction("exists", subquery)};
|
elements = {makeASTFunction("exists", subquery)};
|
||||||
|
|
||||||
finished = true;
|
finished = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user