ir/basic_block: std::move Terminal within SetTerminal and ReplaceTerminal
A terminal isn't a trivial type (and boost::variant is allowed to heap allocate), so we can std::move it here to avoid a redundant copy.
This commit is contained in:
parent
63eff4e7cc
commit
b79ce71b0f
1 changed files with 2 additions and 2 deletions
|
@ -102,12 +102,12 @@ Terminal Block::GetTerminal() const {
|
||||||
|
|
||||||
void Block::SetTerminal(Terminal term) {
|
void Block::SetTerminal(Terminal term) {
|
||||||
ASSERT_MSG(!HasTerminal(), "Terminal has already been set.");
|
ASSERT_MSG(!HasTerminal(), "Terminal has already been set.");
|
||||||
terminal = term;
|
terminal = std::move(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Block::ReplaceTerminal(Terminal term) {
|
void Block::ReplaceTerminal(Terminal term) {
|
||||||
ASSERT_MSG(HasTerminal(), "Terminal has not been set.");
|
ASSERT_MSG(HasTerminal(), "Terminal has not been set.");
|
||||||
terminal = term;
|
terminal = std::move(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Block::HasTerminal() const {
|
bool Block::HasTerminal() const {
|
||||||
|
|
Loading…
Reference in a new issue