From 92839ab4d2fc1378b897b9815707aee127e31bae Mon Sep 17 00:00:00 2001 From: PKEuS Date: Wed, 2 Apr 2014 20:09:53 +0200 Subject: [PATCH] Refactorizations: - Rearranged members of Value to reduce structures size - Removed redundant ctor of Value - Fixed VS warning in tokenize.cpp --- lib/tokenize.cpp | 4 +--- lib/valueflow.h | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 4dfc54442..8d07b0ff1 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -1700,10 +1700,8 @@ bool Tokenizer::hasEnumsWithTypedef() if (Token::Match(tok, "enum %var% {")) { tok = tok->tokAt(2); const Token *tok2 = Token::findsimplematch(tok, "typedef", tok->link()); - if (tok2) { + if (tok2) syntaxError(tok2); - return true; - } } } diff --git a/lib/valueflow.h b/lib/valueflow.h index 558c7bb49..259211afc 100644 --- a/lib/valueflow.h +++ b/lib/valueflow.h @@ -29,27 +29,26 @@ class Settings; namespace ValueFlow { class Value { public: - Value() : condition(0), conditional(false), intvalue(0), inconclusive(false), varId(0U), varvalue(0) {} - 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), conditional(false), intvalue(val), inconclusive(false), varId(0U), varvalue(val) {} + Value(long long val = 0) : condition(0), intvalue(val), varId(0U), varvalue(val), conditional(false), inconclusive(false) {} + Value(const Token *c, long long val) : condition(c), intvalue(val), varId(0U), varvalue(val), conditional(false), inconclusive(false) {} /** Condition that this value depends on (TODO: replace with a 'callstack') */ const Token *condition; - /** Conditional value */ - bool conditional; - /** int value */ - long long intvalue; - - /** Is this value inconclusive? */ - bool inconclusive; + long long intvalue; /** For calculated values - varId that calculated value depends on */ unsigned int varId; /** 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);