Optimized Tokenizer::simplifyPlatformTypes() once more: Another 3% improvement on Windows.
-> All Token::Match strings are uppercase, so check Token::isUpperCaseName() to avoid comparisons with very slow long Token::Match strings (idea from amai) Removed duplicate Token::Match call in symboldatabase.cpp
This commit is contained in:
parent
360fd4a565
commit
b20f87faf2
|
@ -2394,13 +2394,15 @@ void Scope::getVariableList()
|
|||
continue;
|
||||
} else
|
||||
break;
|
||||
} else if (Token::Match(tok, "struct|union {") && Token::Match(tok->next()->link(), "} %var% ;|[")) {
|
||||
tok = tok->next()->link()->tokAt(2);
|
||||
continue;
|
||||
} else if (Token::Match(tok, "struct|union {") && Token::simpleMatch(tok->next()->link(), "} ;")) {
|
||||
level++;
|
||||
tok = tok->next();
|
||||
continue;
|
||||
} else if (Token::Match(tok, "struct|union {")) {
|
||||
if (Token::Match(tok->next()->link(), "} %var% ;|[")) {
|
||||
tok = tok->next()->link()->tokAt(2);
|
||||
continue;
|
||||
} else if (Token::simpleMatch(tok->next()->link(), "} ;")) {
|
||||
level++;
|
||||
tok = tok->next();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Borland C++: Skip all variables in the __published section.
|
||||
|
|
|
@ -5441,8 +5441,11 @@ void Tokenizer::simplifyPlatformTypes()
|
|||
_settings->platformType == Settings::Win32W ||
|
||||
_settings->platformType == Settings::Win64) {
|
||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||
if (!tok->isName())
|
||||
if (tok->type() != Token::eType && tok->type() != Token::eName)
|
||||
continue;
|
||||
if (!tok->isUpperCaseName()) // All WinAPI types are uppercase. Reduce number of Token::Match calls by this condition.
|
||||
continue;
|
||||
|
||||
if (Token::Match(tok, "BOOL|INT|INT32|HFILE|LONG32")) {
|
||||
tok->originalName(tok->str());
|
||||
tok->str("int");
|
||||
|
|
Loading…
Reference in New Issue