Refactoring handling of microsoft types. Ticket: #1956

This commit is contained in:
Robert Reif 2010-08-22 21:53:45 +02:00 committed by Daniel Marjamäki
parent cb7b508f77
commit 807269b5e9
3 changed files with 2 additions and 12 deletions

View File

@ -562,16 +562,7 @@ size_t Token::getStrLength(const Token *tok)
bool Token::isStandardType() const
{
bool ret = false;
const char *type[] = {"bool", "char", "short", "int", "long", "float", "double", "size_t", "__int8", "__int16", "__int32", "__int64", 0};
for (int i = 0; type[i]; i++)
ret |= (_str == type[i]);
return ret;
}
bool Token::isIntegerType() const
{
bool ret = false;
const char *type[] = {"char", "short", "int", "long", "size_t", "__int8", "__int16", "__int32", "__int64", 0};
const char *type[] = {"bool", "char", "short", "int", "long", "float", "double", "size_t", 0};
for (int i = 0; type[i]; i++)
ret |= (_str == type[i]);
return ret;

View File

@ -181,7 +181,6 @@ public:
_isUnused = used;
}
bool isStandardType() const;
bool isIntegerType() const;
static const Token *findmatch(const Token *tok, const char pattern[], unsigned int varId = 0);
static const Token *findmatch(const Token *tok, const char pattern[], const Token *end, unsigned int varId = 0);

View File

@ -4986,7 +4986,7 @@ void Tokenizer::simplifyStdType()
bool isUnsigned = tok->str() == "unsigned";
// unsigned i => unsigned int i
if (!tok->next()->isIntegerType())
if (!Token::Match(tok->next(), "char|short|int|long|__int8|__int16|__int32|__int64"))
tok->str("int");
else
tok->deleteThis();