Tokenizer: Refactoring simplifyPlatformTypes()

This commit is contained in:
Daniel Marjamäki 2016-08-02 19:44:18 +02:00
parent 5e78dae143
commit 908e1b991e
1 changed files with 48 additions and 53 deletions

View File

@ -5579,17 +5579,14 @@ void Tokenizer::simplifyPlatformTypes()
enum { isLongLong, isLong, isInt } type; enum { isLongLong, isLong, isInt } type;
/** @todo This assumes a flat address space. Not true for segmented address space (FAR *). */ /** @todo This assumes a flat address space. Not true for segmented address space (FAR *). */
if (_settings->sizeof_size_t == 8) {
if (_settings->sizeof_long == 8) if (_settings->sizeof_size_t == _settings->sizeof_long)
type = isLong; type = isLong;
else else if (_settings->sizeof_size_t == _settings->sizeof_long_long)
type = isLongLong; type = isLongLong;
} else if (_settings->sizeof_size_t == 4) { else if (_settings->sizeof_size_t == _settings->sizeof_int)
if (_settings->sizeof_long == 4)
type = isLong;
else
type = isInt; type = isInt;
} else else
return; return;
for (Token *tok = list.front(); tok; tok = tok->next()) { for (Token *tok = list.front(); tok; tok = tok->next()) {
@ -5636,8 +5633,7 @@ void Tokenizer::simplifyPlatformTypes()
} }
} }
if (_settings->isWindowsPlatform()) { const std::string platform_type(_settings->platformString());
std::string platform_type(_settings->platformString());
for (Token *tok = list.front(); tok; tok = tok->next()) { for (Token *tok = list.front(); tok; tok = tok->next()) {
if (tok->tokType() != Token::eType && tok->tokType() != Token::eName) if (tok->tokType() != Token::eType && tok->tokType() != Token::eName)
@ -5683,7 +5679,6 @@ void Tokenizer::simplifyPlatformTypes()
typeToken->isLong(true); typeToken->isLong(true);
} }
} }
}
} }
void Tokenizer::simplifyStdType() void Tokenizer::simplifyStdType()