avoid some unnecessary copies in emplace_back() calls (#2194)
This commit is contained in:
parent
846f356db4
commit
1fa4df419a
|
@ -745,10 +745,10 @@ bool TemplateSimplifier::getTemplateDeclarations()
|
||||||
TokenAndName decl(tok, tok->scopeInfo()->name, parmEnd->tokAt(namepos), parmEnd);
|
TokenAndName decl(tok, tok->scopeInfo()->name, parmEnd->tokAt(namepos), parmEnd);
|
||||||
if (decl.isForwardDeclaration()) {
|
if (decl.isForwardDeclaration()) {
|
||||||
// Declaration => add to mTemplateForwardDeclarations
|
// Declaration => add to mTemplateForwardDeclarations
|
||||||
mTemplateForwardDeclarations.emplace_back(decl);
|
mTemplateForwardDeclarations.emplace_back(std::move(decl));
|
||||||
} else {
|
} else {
|
||||||
// Implementation => add to mTemplateDeclarations
|
// Implementation => add to mTemplateDeclarations
|
||||||
mTemplateDeclarations.emplace_back(decl);
|
mTemplateDeclarations.emplace_back(std::move(decl));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5316,7 +5316,7 @@ static bool evaluate(const Token *expr, const std::vector<std::list<ValueFlow::V
|
||||||
res.valueType = ValueFlow::Value::INT;
|
res.valueType = ValueFlow::Value::INT;
|
||||||
res.tokvalue = nullptr;
|
res.tokvalue = nullptr;
|
||||||
res.intvalue = Token::getStrLength(argvalue.tokvalue);
|
res.intvalue = Token::getStrLength(argvalue.tokvalue);
|
||||||
result->emplace_back(res);
|
result->emplace_back(std::move(res));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !result->empty();
|
return !result->empty();
|
||||||
|
@ -5335,7 +5335,7 @@ static bool evaluate(const Token *expr, const std::vector<std::list<ValueFlow::V
|
||||||
for (ValueFlow::Value v: opvalues) {
|
for (ValueFlow::Value v: opvalues) {
|
||||||
if (v.isIntValue()) {
|
if (v.isIntValue()) {
|
||||||
v.intvalue = -v.intvalue;
|
v.intvalue = -v.intvalue;
|
||||||
result->emplace_back(v);
|
result->emplace_back(std::move(v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -6097,7 +6097,7 @@ static void valueFlowContainerAfterCondition(TokenList *tokenlist,
|
||||||
ValueFlow::Value value(tok, 0LL);
|
ValueFlow::Value value(tok, 0LL);
|
||||||
value.valueType = ValueFlow::Value::ValueType::CONTAINER_SIZE;
|
value.valueType = ValueFlow::Value::ValueType::CONTAINER_SIZE;
|
||||||
cond.true_values.emplace_back(value);
|
cond.true_values.emplace_back(value);
|
||||||
cond.false_values.emplace_back(value);
|
cond.false_values.emplace_back(std::move(value));
|
||||||
cond.vartok = vartok;
|
cond.vartok = vartok;
|
||||||
return cond;
|
return cond;
|
||||||
}
|
}
|
||||||
|
@ -6118,7 +6118,7 @@ static void valueFlowContainerAfterCondition(TokenList *tokenlist,
|
||||||
ValueFlow::Value value(tok, Token::getStrLength(strtok));
|
ValueFlow::Value value(tok, Token::getStrLength(strtok));
|
||||||
value.valueType = ValueFlow::Value::ValueType::CONTAINER_SIZE;
|
value.valueType = ValueFlow::Value::ValueType::CONTAINER_SIZE;
|
||||||
cond.false_values.emplace_back(value);
|
cond.false_values.emplace_back(value);
|
||||||
cond.true_values.emplace_back(value);
|
cond.true_values.emplace_back(std::move(value));
|
||||||
cond.vartok = vartok;
|
cond.vartok = vartok;
|
||||||
return cond;
|
return cond;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue