From 360fd4a565c64c01fac83cbc6b0c03958c640494 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Wed, 25 Jun 2014 17:00:02 +0200 Subject: [PATCH] Speedup Tokenizer::simplifyMathFunctions() and Tokenizer::simplifyPlatformTypes() -> Speedup on entire checking time (TortoiseSVN code) by 3% (MSVC12, x64, not matchcompiled). Probably only measurable when checking code with Windows platform. --- lib/tokenize.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 38c059d1f..c912f1e3c 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5441,6 +5441,8 @@ void Tokenizer::simplifyPlatformTypes() _settings->platformType == Settings::Win32W || _settings->platformType == Settings::Win64) { for (Token *tok = list.front(); tok; tok = tok->next()) { + if (!tok->isName()) + continue; if (Token::Match(tok, "BOOL|INT|INT32|HFILE|LONG32")) { tok->originalName(tok->str()); tok->str("int"); @@ -8217,8 +8219,7 @@ bool Tokenizer::simplifyMathFunctions() { bool simplifcationMade = false; for (Token *tok = list.front(); tok; tok = tok->next()) { - const Token * tokNext = tok->next(); - if (tokNext && tokNext->str() == "(") { // precondition for function + if (tok->isName() && tok->strAt(1) == "(") { // precondition for function if (Token::Match(tok, "atol ( %str% )")) { //@todo Add support for atoll() if (tok->previous() && Token::simpleMatch(tok->tokAt(-2), "std ::")) {