Optimisation: small speedups in the Tokenizer::simplifyTokenList handling
This commit is contained in:
parent
86e517c5d3
commit
056037feed
|
@ -8174,14 +8174,28 @@ void Tokenizer::simplifyStructDecl()
|
||||||
|
|
||||||
void Tokenizer::simplifyCallingConvention()
|
void Tokenizer::simplifyCallingConvention()
|
||||||
{
|
{
|
||||||
const char * pattern = "__cdecl|__stdcall|__fastcall|__thiscall|__clrcall|__syscall|__pascal|__fortran|__far|__near|WINAPI|APIENTRY|CALLBACK";
|
std::set<std::string> str;
|
||||||
while (Token::Match(_tokens, pattern))
|
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())
|
||||||
{
|
{
|
||||||
_tokens->deleteThis();
|
_tokens->deleteThis();
|
||||||
}
|
}
|
||||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
for (Token *tok = _tokens; tok; tok = tok->next())
|
||||||
{
|
{
|
||||||
while (Token::Match(tok->next(), pattern))
|
while (tok->next() && str.find(tok->next()->str()) != str.end())
|
||||||
{
|
{
|
||||||
tok->deleteNext();
|
tok->deleteNext();
|
||||||
}
|
}
|
||||||
|
@ -8435,6 +8449,8 @@ void Tokenizer::simplifyBuiltinExpect()
|
||||||
void Tokenizer::simplifyMicrosoftMFC()
|
void Tokenizer::simplifyMicrosoftMFC()
|
||||||
{
|
{
|
||||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
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 ( )"))
|
||||||
{
|
{
|
||||||
|
@ -8450,6 +8466,7 @@ void Tokenizer::simplifyMicrosoftMFC()
|
||||||
tok->deleteNext();
|
tok->deleteNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue