From 807269b5e9735cc76771876c2eb52b7fa0cb3166 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Sun, 22 Aug 2010 21:53:45 +0200 Subject: [PATCH] Refactoring handling of microsoft types. Ticket: #1956 --- lib/token.cpp | 11 +---------- lib/token.h | 1 - lib/tokenize.cpp | 2 +- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/token.cpp b/lib/token.cpp index ba5e7c51c..14b77a7db 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -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; diff --git a/lib/token.h b/lib/token.h index 5ebcb55fe..1137d2758 100644 --- a/lib/token.h +++ b/lib/token.h @@ -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); diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 0e288bf13..ad6bc69e7 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -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();