clang warnings (#1547)

* valueflow: remove unused variable known

since e4677ae640 will trigger :

lib/valueflow.cpp:506:20: warning: unused variable 'known' [-Wunused-variable]
        const bool known = (parent->astOperand1()->hasKnownValue() ||

* templatesimplifier: cleanup

since 48c960f56c showing:

lib/templatesimplifier.h:279:16: warning: private field 'mTokenizer' is not used
      [-Wunused-private-field]
    Tokenizer *mTokenizer;
This commit is contained in:
Carlo Marcelo Arenas Belón 2018-12-30 00:32:48 -10:00 committed by orbitcowboy
parent 3f318548e2
commit 5ae6861a0f
3 changed files with 1 additions and 4 deletions

View File

@ -74,7 +74,7 @@ TemplateSimplifier::TokenAndName::~TokenAndName()
}
TemplateSimplifier::TemplateSimplifier(Tokenizer *tokenizer)
: mTokenizer(tokenizer), mTokenList(tokenizer->list), mSettings(tokenizer->mSettings), mErrorLogger(tokenizer->mErrorLogger)
: mTokenList(tokenizer->list), mSettings(tokenizer->mSettings), mErrorLogger(tokenizer->mErrorLogger)
{
}

View File

@ -276,7 +276,6 @@ private:
Token *tok2,
std::list<std::string> &typeStringsUsedInTemplateInstantiation);
Tokenizer *mTokenizer;
TokenList &mTokenList;
const Settings *mSettings;
ErrorLogger *mErrorLogger;

View File

@ -503,8 +503,6 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value, const Setti
else if ((parent->isArithmeticalOp() || parent->isComparisonOp() || (parent->tokType() == Token::eBitOp) || (parent->tokType() == Token::eLogicalOp)) &&
parent->astOperand1() &&
parent->astOperand2()) {
const bool known = (parent->astOperand1()->hasKnownValue() ||
parent->astOperand2()->hasKnownValue());
// known result when a operand is 0.
if (Token::Match(parent, "[&*]") && value.isKnown() && value.isIntValue() && value.intvalue==0) {