Simplify known variableswhen they are at the end of a statement.
This commit is contained in:
parent
5fa2fe0b21
commit
85b47636dc
|
@ -6732,9 +6732,9 @@ bool Tokenizer::simplifyKnownVariablesSimplify(Token **tok2, Token *tok3, unsign
|
|||
ret = true;
|
||||
}
|
||||
|
||||
// condition "(|&&|%OROR% %varid% )|&&|%OROR%
|
||||
// condition "(|&&|%OROR% %varid% )|&&|%OROR%|;
|
||||
if (!Token::Match(tok3->previous(), "( %name% )") &&
|
||||
Token::Match(tok3->previous(), "&&|(|%oror% %varid% &&|%oror%|)", varid)) {
|
||||
Token::Match(tok3->previous(), "&&|(|%oror% %varid% &&|%oror%|)|;", varid)) {
|
||||
tok3->str(value);
|
||||
tok3->varId(valueVarId);
|
||||
ret = true;
|
||||
|
|
|
@ -2231,8 +2231,7 @@ private:
|
|||
"4:\n"
|
||||
"5: return u@1 && v@2 ;\n"
|
||||
"6: }\n";
|
||||
const char current[] = "\n\n##file 0\n1: bool foo ( int u@1 , int v@2 )\n2: {\n3:\n4: int i@4 ; i@4 = v@2 ;\n5: return u@1 && i@4 ;\n6: }\n";
|
||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||
ASSERT_EQUALS(wanted, tokenizeDebugListing(code, true));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -2245,12 +2244,11 @@ private:
|
|||
const char wanted[] = "\n\n##file 0\n"
|
||||
"1: bool foo ( int u@1 , int v@2 )\n"
|
||||
"2: {\n"
|
||||
"3: ;\n"
|
||||
"4: ;\n"
|
||||
"3:\n"
|
||||
"4:\n"
|
||||
"5: return u@1 || v@2 ;\n"
|
||||
"6: }\n";
|
||||
const char current[] = "\n\n##file 0\n1: bool foo ( int u@1 , int v@2 )\n2: {\n3:\n4: int i@4 ; i@4 = v@2 ;\n5: return u@1 || i@4 ;\n6: }\n";
|
||||
TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true));
|
||||
ASSERT_EQUALS(wanted, tokenizeDebugListing(code, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue