diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 38767cef6..8ec538f45 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -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; diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 27ebe13a5..fd45f05af 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -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)); } }