Renamed isCasted to isCast

This commit is contained in:
Daniel Marjamäki 2014-12-24 10:35:40 +01:00
parent de1a91f30d
commit 90bd38a972
4 changed files with 12 additions and 12 deletions

View File

@ -841,7 +841,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const ArrayInfo &arrayInfo
valueFlowCheckArrayIndex(tok->next(), 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; const ValueFlow::Value *index;
if (tok == tok->astParent()->astOperand1()) if (tok == tok->astParent()->astOperand1())
index = tok->astParent()->astOperand2()->getMaxValue(false); index = tok->astParent()->astOperand2()->getMaxValue(false);

View File

@ -1734,7 +1734,7 @@ void CheckOther::checkIncompleteStatement()
continue; continue;
// No warning for [;{}] (void *) 0 ; // No warning for [;{}] (void *) 0 ;
if (Token::Match(tok, "[;{}] 0 ;") && tok->next()->isCasted()) if (Token::Match(tok, "[;{}] 0 ;") && tok->next()->isCast())
continue; continue;
// bailout if there is a "? :" in this statement // bailout if there is a "? :" in this statement

View File

@ -313,11 +313,11 @@ public:
void isExpandedMacro(bool m) { void isExpandedMacro(bool m) {
setFlag(fIsExpandedMacro, m); setFlag(fIsExpandedMacro, m);
} }
bool isCasted() const { bool isCast() const {
return getFlag(fIsCasted); return getFlag(fIsCast);
} }
void isCasted(bool c) { void isCast(bool c) {
setFlag(fIsCasted, c); setFlag(fIsCast, c);
} }
bool isAttributeConstructor() const { bool isAttributeConstructor() const {
return getFlag(fIsAttributeConstructor); return getFlag(fIsAttributeConstructor);
@ -759,7 +759,7 @@ private:
fIsLong = (1 << 3), fIsLong = (1 << 3),
fIsStandardType = (1 << 4), fIsStandardType = (1 << 4),
fIsExpandedMacro = (1 << 5), fIsExpandedMacro = (1 << 5),
fIsCasted = (1 << 6), fIsCast = (1 << 6),
fIsAttributeConstructor = (1 << 7), // __attribute__((constructor)) __attribute__((constructor(priority))) fIsAttributeConstructor = (1 << 7), // __attribute__((constructor)) __attribute__((constructor(priority)))
fIsAttributeDestructor = (1 << 8), // __attribute__((destructor)) __attribute__((destructor(priority))) fIsAttributeDestructor = (1 << 8), // __attribute__((destructor)) __attribute__((destructor(priority)))
fIsAttributeUnused = (1 << 9), // __attribute__((unused)) fIsAttributeUnused = (1 << 9), // __attribute__((unused))

View File

@ -5004,7 +5004,7 @@ void Tokenizer::simplifyCasts()
if (!tok->tokAt(2)->isUnsigned() && bits > 0) if (!tok->tokAt(2)->isUnsigned() && bits > 0)
bits--; bits--;
if (bits < 31 && value >= 0 && value < (1LL << 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()); Token::eraseTokens(tok, tok->next()->link()->next());
} }
continue; continue;
@ -5027,10 +5027,10 @@ void Tokenizer::simplifyCasts()
// Set isCasted flag. // Set isCasted flag.
Token *tok2 = tok->next(); Token *tok2 = tok->next();
if (!Token::Match(tok2, "%var% [|.")) if (!Token::Match(tok2, "%var% [|."))
tok2->isCasted(true); tok2->isCast(true);
else { else {
// TODO: handle more complex expressions // TODO: handle more complex expressions
tok2->next()->isCasted(true); tok2->next()->isCast(true);
} }
// Remove '* &' // Remove '* &'
@ -5048,7 +5048,7 @@ void Tokenizer::simplifyCasts()
// Replace pointer casts of 0.. "(char *)0" => "0" // Replace pointer casts of 0.. "(char *)0" => "0"
while (Token::Match(tok->next(), "( %type% %type%| * ) 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()); Token::eraseTokens(tok, tok->next()->link()->next());
if (tok->str() == ")" && tok->link()->previous()) { if (tok->str() == ")" && tok->link()->previous()) {
// If there was another cast before this, go back // If there was another cast before this, go back
@ -5062,7 +5062,7 @@ void Tokenizer::simplifyCasts()
if (!Token::simpleMatch(tok2, "> (")) if (!Token::simpleMatch(tok2, "> ("))
break; break;
tok2->tokAt(2)->isCasted(true); tok2->tokAt(2)->isCast(true);
Token::eraseTokens(tok, tok2->next()); Token::eraseTokens(tok, tok2->next());
} }
} }