Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 4 additions & 6 deletions test/testtokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,7 @@ class TestTokenizer : public TestFixture {
"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));
}

{
Expand All @@ -2245,12 +2244,11 @@ class TestTokenizer : public TestFixture {
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));
}
}

Expand Down