From ff7a99ad379b84bf771b3097ffa80d4080bc8b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 24 Sep 2010 22:18:51 +0200 Subject: [PATCH] Revert "Optimisation: small speedups in the Tokenizer::simplifyTokenList handling" This reverts commit 056037feed8503f5e51428da5cf37aa24d502ffc. --- lib/tokenize.cpp | 45 ++++++++++++++------------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index d01652905..d5adfb82f 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -8174,28 +8174,14 @@ void Tokenizer::simplifyStructDecl() void Tokenizer::simplifyCallingConvention() { - std::set str; - str.insert("__cdecl"); - str.insert("__stdcall"); - str.insert("__fastcall"); - str.insert("__thiscall"); - str.insert("__clrcall"); - str.insert("__syscall"); - str.insert("__pascal"); - str.insert("__fortran"); - str.insert("__far"); - str.insert("__near"); - str.insert("WINAPI"); - str.insert("APIENTRY"); - str.insert("CALLBACK"); - - while (_tokens && str.find(_tokens->str()) != str.end()) + const char * pattern = "__cdecl|__stdcall|__fastcall|__thiscall|__clrcall|__syscall|__pascal|__fortran|__far|__near|WINAPI|APIENTRY|CALLBACK"; + while (Token::Match(_tokens, pattern)) { _tokens->deleteThis(); } for (Token *tok = _tokens; tok; tok = tok->next()) { - while (tok->next() && str.find(tok->next()->str()) != str.end()) + while (Token::Match(tok->next(), pattern)) { tok->deleteNext(); } @@ -8450,21 +8436,18 @@ void Tokenizer::simplifyMicrosoftMFC() { for (Token *tok = _tokens; tok; tok = tok->next()) { - if (tok->str().compare(0,9,"DECLARE_") == 0) + if (Token::simpleMatch(tok->next(), "DECLARE_MESSAGE_MAP ( )")) { - if (Token::simpleMatch(tok->next(), "DECLARE_MESSAGE_MAP ( )")) - { - tok->deleteNext(); - tok->deleteNext(); - tok->deleteNext(); - } - else if (Token::Match(tok->next(), "DECLARE_DYNAMIC|DECLARE_DYNAMIC_CLASS|DECLARE_DYNCREATE ( %any% )")) - { - tok->deleteNext(); - tok->deleteNext(); - tok->deleteNext(); - tok->deleteNext(); - } + tok->deleteNext(); + tok->deleteNext(); + tok->deleteNext(); + } + else if (Token::Match(tok->next(), "DECLARE_DYNAMIC|DECLARE_DYNAMIC_CLASS|DECLARE_DYNCREATE ( %any% )")) + { + tok->deleteNext(); + tok->deleteNext(); + tok->deleteNext(); + tok->deleteNext(); } } }