diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 779dde147..4a03f4069 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3992,19 +3992,6 @@ bool Tokenizer::simplifyTokenList() simplifySizeof(); - // replace strlen(str) - simplifyKnownVariables(); - for (Token *tok = _tokens; tok; tok = tok->next()) { - if (Token::Match(tok, "strlen ( %str% )")) { - std::ostringstream ostr; - ostr << Token::getStrLength(tok->tokAt(2)); - tok->str(ostr.str()); - tok->deleteNext(); - tok->deleteNext(); - tok->deleteNext(); - } - } - // change array to pointer.. for (Token *tok = _tokens; tok; tok = tok->next()) { if (Token::Match(tok, "%type% %var% [ ] [,;=]")) { @@ -4155,6 +4142,18 @@ bool Tokenizer::simplifyTokenList() modified |= simplifyCalculations(); } + // replace strlen(str) + for (Token *tok = _tokens; tok; tok = tok->next()) { + if (Token::Match(tok, "strlen ( %str% )")) { + std::ostringstream ostr; + ostr << Token::getStrLength(tok->tokAt(2)); + tok->str(ostr.str()); + tok->deleteNext(); + tok->deleteNext(); + tok->deleteNext(); + } + } + // simplify redundant for removeRedundantFor();