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.
This commit is contained in:
PKEuS 2014-06-25 17:00:02 +02:00
parent 5af96c2dd8
commit 360fd4a565
1 changed files with 3 additions and 2 deletions

View File

@ -5441,6 +5441,8 @@ void Tokenizer::simplifyPlatformTypes()
_settings->platformType == Settings::Win32W || _settings->platformType == Settings::Win32W ||
_settings->platformType == Settings::Win64) { _settings->platformType == Settings::Win64) {
for (Token *tok = list.front(); tok; tok = tok->next()) { for (Token *tok = list.front(); tok; tok = tok->next()) {
if (!tok->isName())
continue;
if (Token::Match(tok, "BOOL|INT|INT32|HFILE|LONG32")) { if (Token::Match(tok, "BOOL|INT|INT32|HFILE|LONG32")) {
tok->originalName(tok->str()); tok->originalName(tok->str());
tok->str("int"); tok->str("int");
@ -8217,8 +8219,7 @@ bool Tokenizer::simplifyMathFunctions()
{ {
bool simplifcationMade = false; bool simplifcationMade = false;
for (Token *tok = list.front(); tok; tok = tok->next()) { for (Token *tok = list.front(); tok; tok = tok->next()) {
const Token * tokNext = tok->next(); if (tok->isName() && tok->strAt(1) == "(") { // precondition for function
if (tokNext && tokNext->str() == "(") { // precondition for function
if (Token::Match(tok, "atol ( %str% )")) { //@todo Add support for atoll() if (Token::Match(tok, "atol ( %str% )")) { //@todo Add support for atoll()
if (tok->previous() && if (tok->previous() &&
Token::simpleMatch(tok->tokAt(-2), "std ::")) { Token::simpleMatch(tok->tokAt(-2), "std ::")) {