diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 94ebd95b2..dfb9d5d91 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -841,7 +841,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const ArrayInfo &arrayInfo valueFlowCheckArrayIndex(tok->next(), arrayInfo); } - else if (isPortabilityEnabled && !tok->isCasted() && tok->astParent() && tok->astParent()->str() == "+") { + else if (isPortabilityEnabled && !tok->isCast() && tok->astParent() && tok->astParent()->str() == "+") { const ValueFlow::Value *index; if (tok == tok->astParent()->astOperand1()) index = tok->astParent()->astOperand2()->getMaxValue(false); diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 8fc49c78d..5e230b1c8 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1734,7 +1734,7 @@ void CheckOther::checkIncompleteStatement() continue; // No warning for [;{}] (void *) 0 ; - if (Token::Match(tok, "[;{}] 0 ;") && tok->next()->isCasted()) + if (Token::Match(tok, "[;{}] 0 ;") && tok->next()->isCast()) continue; // bailout if there is a "? :" in this statement diff --git a/lib/token.h b/lib/token.h index 1ede4fdb4..089a043b4 100644 --- a/lib/token.h +++ b/lib/token.h @@ -313,11 +313,11 @@ public: void isExpandedMacro(bool m) { setFlag(fIsExpandedMacro, m); } - bool isCasted() const { - return getFlag(fIsCasted); + bool isCast() const { + return getFlag(fIsCast); } - void isCasted(bool c) { - setFlag(fIsCasted, c); + void isCast(bool c) { + setFlag(fIsCast, c); } bool isAttributeConstructor() const { return getFlag(fIsAttributeConstructor); @@ -759,7 +759,7 @@ private: fIsLong = (1 << 3), fIsStandardType = (1 << 4), fIsExpandedMacro = (1 << 5), - fIsCasted = (1 << 6), + fIsCast = (1 << 6), fIsAttributeConstructor = (1 << 7), // __attribute__((constructor)) __attribute__((constructor(priority))) fIsAttributeDestructor = (1 << 8), // __attribute__((destructor)) __attribute__((destructor(priority))) fIsAttributeUnused = (1 << 9), // __attribute__((unused)) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index c05b2756e..6420410cf 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5004,7 +5004,7 @@ void Tokenizer::simplifyCasts() if (!tok->tokAt(2)->isUnsigned() && bits > 0) bits--; if (bits < 31 && value >= 0 && value < (1LL << bits)) { - tok->linkAt(1)->next()->isCasted(true); + tok->linkAt(1)->next()->isCast(true); Token::eraseTokens(tok, tok->next()->link()->next()); } continue; @@ -5027,10 +5027,10 @@ void Tokenizer::simplifyCasts() // Set isCasted flag. Token *tok2 = tok->next(); if (!Token::Match(tok2, "%var% [|.")) - tok2->isCasted(true); + tok2->isCast(true); else { // TODO: handle more complex expressions - tok2->next()->isCasted(true); + tok2->next()->isCast(true); } // Remove '* &' @@ -5048,7 +5048,7 @@ void Tokenizer::simplifyCasts() // Replace pointer casts of 0.. "(char *)0" => "0" while (Token::Match(tok->next(), "( %type% %type%| * ) 0")) { - tok->linkAt(1)->next()->isCasted(true); + tok->linkAt(1)->next()->isCast(true); Token::eraseTokens(tok, tok->next()->link()->next()); if (tok->str() == ")" && tok->link()->previous()) { // If there was another cast before this, go back @@ -5062,7 +5062,7 @@ void Tokenizer::simplifyCasts() if (!Token::simpleMatch(tok2, "> (")) break; - tok2->tokAt(2)->isCasted(true); + tok2->tokAt(2)->isCast(true); Token::eraseTokens(tok, tok2->next()); } }