Merge pull request #359 from Dmitry-Me/useReferencesToAvoidDeepCopy
Use references instead of deep copying the strings
This commit is contained in:
commit
bc6a320f91
|
@ -10378,14 +10378,14 @@ void Tokenizer::simplifyMathExpressions()
|
||||||
Token * const tok2 = tok->linkAt(3);
|
Token * const tok2 = tok->linkAt(3);
|
||||||
if (!Token::Match(tok2, ") , %num% ) + pow|powf|powl ( cos|cosf|cosl ("))
|
if (!Token::Match(tok2, ") , %num% ) + pow|powf|powl ( cos|cosf|cosl ("))
|
||||||
continue;
|
continue;
|
||||||
std::string leftExponent = tok2->strAt(2);
|
const std::string& leftExponent = tok2->strAt(2);
|
||||||
if (!isTwoNumber(leftExponent))
|
if (!isTwoNumber(leftExponent))
|
||||||
continue; // left exponent is not 2
|
continue; // left exponent is not 2
|
||||||
Token * const tok3 = tok2->tokAt(8);
|
Token * const tok3 = tok2->tokAt(8);
|
||||||
if (!Token::Match(tok3->link(), ") , %num% )"))
|
if (!Token::Match(tok3->link(), ") , %num% )"))
|
||||||
continue;
|
continue;
|
||||||
Token * const tok4 = tok3->link();
|
Token * const tok4 = tok3->link();
|
||||||
std::string rightExponent = tok4->strAt(2);
|
const std::string& rightExponent = tok4->strAt(2);
|
||||||
if (!isTwoNumber(rightExponent))
|
if (!isTwoNumber(rightExponent))
|
||||||
continue; // right exponent is not 2
|
continue; // right exponent is not 2
|
||||||
if (tok->tokAt(3)->stringifyList(tok2->next()) == tok3->stringifyList(tok3->link()->next())) {
|
if (tok->tokAt(3)->stringifyList(tok2->next()) == tok3->stringifyList(tok3->link()->next())) {
|
||||||
|
@ -10396,14 +10396,14 @@ void Tokenizer::simplifyMathExpressions()
|
||||||
Token * const tok2 = tok->linkAt(3);
|
Token * const tok2 = tok->linkAt(3);
|
||||||
if (!Token::Match(tok2, ") , %num% ) + pow|powf|powl ( sin|sinf|sinl ("))
|
if (!Token::Match(tok2, ") , %num% ) + pow|powf|powl ( sin|sinf|sinl ("))
|
||||||
continue;
|
continue;
|
||||||
std::string leftExponent = tok2->strAt(2);
|
const std::string& leftExponent = tok2->strAt(2);
|
||||||
if (!isTwoNumber(leftExponent))
|
if (!isTwoNumber(leftExponent))
|
||||||
continue; // left exponent is not 2
|
continue; // left exponent is not 2
|
||||||
Token * const tok3 = tok2->tokAt(8);
|
Token * const tok3 = tok2->tokAt(8);
|
||||||
if (!Token::Match(tok3->link(), ") , %num% )"))
|
if (!Token::Match(tok3->link(), ") , %num% )"))
|
||||||
continue;
|
continue;
|
||||||
Token * const tok4 = tok3->link();
|
Token * const tok4 = tok3->link();
|
||||||
std::string rightExponent = tok4->strAt(2);
|
const std::string& rightExponent = tok4->strAt(2);
|
||||||
if (!isTwoNumber(rightExponent))
|
if (!isTwoNumber(rightExponent))
|
||||||
continue; // right exponent is not 2
|
continue; // right exponent is not 2
|
||||||
if (tok->tokAt(3)->stringifyList(tok2->next()) == tok3->stringifyList(tok3->link()->next())) {
|
if (tok->tokAt(3)->stringifyList(tok2->next()) == tok3->stringifyList(tok3->link()->next())) {
|
||||||
|
@ -10414,14 +10414,14 @@ void Tokenizer::simplifyMathExpressions()
|
||||||
Token * const tok2 = tok->linkAt(3);
|
Token * const tok2 = tok->linkAt(3);
|
||||||
if (!Token::Match(tok2, ") , %num% ) - pow|powf|powl ( cosh|coshf|coshl ("))
|
if (!Token::Match(tok2, ") , %num% ) - pow|powf|powl ( cosh|coshf|coshl ("))
|
||||||
continue;
|
continue;
|
||||||
std::string leftExponent = tok2->strAt(2);
|
const std::string& leftExponent = tok2->strAt(2);
|
||||||
if (!isTwoNumber(leftExponent))
|
if (!isTwoNumber(leftExponent))
|
||||||
continue; // left exponent is not 2
|
continue; // left exponent is not 2
|
||||||
Token * const tok3 = tok2->tokAt(8);
|
Token * const tok3 = tok2->tokAt(8);
|
||||||
if (!Token::Match(tok3->link(), ") , %num% )"))
|
if (!Token::Match(tok3->link(), ") , %num% )"))
|
||||||
continue;
|
continue;
|
||||||
Token * const tok4 = tok3->link();
|
Token * const tok4 = tok3->link();
|
||||||
std::string rightExponent = tok4->strAt(2);
|
const std::string& rightExponent = tok4->strAt(2);
|
||||||
if (!isTwoNumber(rightExponent))
|
if (!isTwoNumber(rightExponent))
|
||||||
continue; // right exponent is not 2
|
continue; // right exponent is not 2
|
||||||
if (tok->tokAt(3)->stringifyList(tok2->next()) == tok3->stringifyList(tok3->link()->next())) {
|
if (tok->tokAt(3)->stringifyList(tok2->next()) == tok3->stringifyList(tok3->link()->next())) {
|
||||||
|
@ -10432,14 +10432,14 @@ void Tokenizer::simplifyMathExpressions()
|
||||||
Token * const tok2 = tok->linkAt(3);
|
Token * const tok2 = tok->linkAt(3);
|
||||||
if (!Token::Match(tok2, ") , %num% ) - pow|powf|powl ( sinh|sinhf|sinhl ("))
|
if (!Token::Match(tok2, ") , %num% ) - pow|powf|powl ( sinh|sinhf|sinhl ("))
|
||||||
continue;
|
continue;
|
||||||
std::string leftExponent = tok2->strAt(2);
|
const std::string& leftExponent = tok2->strAt(2);
|
||||||
if (!isTwoNumber(leftExponent))
|
if (!isTwoNumber(leftExponent))
|
||||||
continue; // left exponent is not 2
|
continue; // left exponent is not 2
|
||||||
Token * const tok3 = tok2->tokAt(8);
|
Token * const tok3 = tok2->tokAt(8);
|
||||||
if (!Token::Match(tok3->link(), ") , %num% )"))
|
if (!Token::Match(tok3->link(), ") , %num% )"))
|
||||||
continue;
|
continue;
|
||||||
Token * const tok4 = tok3->link();
|
Token * const tok4 = tok3->link();
|
||||||
std::string rightExponent = tok4->strAt(2);
|
const std::string& rightExponent = tok4->strAt(2);
|
||||||
if (!isTwoNumber(rightExponent))
|
if (!isTwoNumber(rightExponent))
|
||||||
continue; // right exponent is not 2
|
continue; // right exponent is not 2
|
||||||
if (tok->tokAt(3)->stringifyList(tok2->next()) == tok3->stringifyList(tok3->link()->next())) {
|
if (tok->tokAt(3)->stringifyList(tok2->next()) == tok3->stringifyList(tok3->link()->next())) {
|
||||||
|
|
Loading…
Reference in New Issue