Refactorizations:

- Rearranged members of Value to reduce structures size
- Removed redundant ctor of Value
- Fixed VS warning in tokenize.cpp
This commit is contained in:
PKEuS 2014-04-02 20:09:53 +02:00
parent 718e42f5ca
commit 92839ab4d2
2 changed files with 11 additions and 14 deletions

View File

@ -1700,10 +1700,8 @@ bool Tokenizer::hasEnumsWithTypedef()
if (Token::Match(tok, "enum %var% {")) { if (Token::Match(tok, "enum %var% {")) {
tok = tok->tokAt(2); tok = tok->tokAt(2);
const Token *tok2 = Token::findsimplematch(tok, "typedef", tok->link()); const Token *tok2 = Token::findsimplematch(tok, "typedef", tok->link());
if (tok2) { if (tok2)
syntaxError(tok2); syntaxError(tok2);
return true;
}
} }
} }

View File

@ -29,27 +29,26 @@ class Settings;
namespace ValueFlow { namespace ValueFlow {
class Value { class Value {
public: public:
Value() : condition(0), conditional(false), intvalue(0), inconclusive(false), varId(0U), varvalue(0) {} Value(long long val = 0) : condition(0), intvalue(val), varId(0U), varvalue(val), conditional(false), inconclusive(false) {}
Value(long long val) : condition(0), conditional(false), intvalue(val), inconclusive(false), varId(0U), varvalue(val) {} Value(const Token *c, long long val) : condition(c), intvalue(val), varId(0U), varvalue(val), conditional(false), inconclusive(false) {}
Value(const Token *c, long long val) : condition(c), conditional(false), intvalue(val), inconclusive(false), varId(0U), varvalue(val) {}
/** Condition that this value depends on (TODO: replace with a 'callstack') */ /** Condition that this value depends on (TODO: replace with a 'callstack') */
const Token *condition; const Token *condition;
/** Conditional value */
bool conditional;
/** int value */ /** int value */
long long intvalue; long long intvalue;
/** Is this value inconclusive? */
bool inconclusive;
/** For calculated values - varId that calculated value depends on */ /** For calculated values - varId that calculated value depends on */
unsigned int varId; unsigned int varId;
/** For calculated values - variable value that calculated value depends on */ /** For calculated values - variable value that calculated value depends on */
long long varvalue; long long varvalue;
/** Conditional value */
bool conditional;
/** Is this value inconclusive? */
bool inconclusive;
}; };
void setValues(TokenList *tokenlist, ErrorLogger *errorLogger, const Settings *settings); void setValues(TokenList *tokenlist, ErrorLogger *errorLogger, const Settings *settings);