File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2017,8 +2017,8 @@ void CheckOtherImpl::checkConstPointer()
20172017 pointers.emplace (var);
20182018 const Token* parent = tok->astParent ();
20192019 enum Deref : std::uint8_t { NONE , DEREF , MEMBER } deref = NONE ;
2020- bool hasIncDecPlus = false ;
2021- if (parent && (parent->isUnaryOp (" *" ) || (((hasIncDecPlus = parent->isIncDecOp ()) || (hasIncDecPlus = (parent-> str () == " + " ))) &&
2020+ bool hasIncDecPlusMinus = false ;
2021+ if (parent && (parent->isUnaryOp (" *" ) || (((hasIncDecPlusMinus = parent->isIncDecOp ()) || (hasIncDecPlusMinus = Token::Match (parent, " [+-] " ))) &&
20222022 parent->astParent () && parent->astParent ()->isUnaryOp (" *" ))))
20232023 deref = DEREF ;
20242024 else if (Token::simpleMatch (parent, " [" ) && parent->astOperand1 () == tok && tok != nameTok)
@@ -2054,7 +2054,7 @@ void CheckOtherImpl::checkConstPointer()
20542054 }
20552055 }
20562056 }
2057- if (hasIncDecPlus ) {
2057+ if (hasIncDecPlusMinus ) {
20582058 parent = gparent;
20592059 gparent = gparent ? gparent->astParent () : nullptr ;
20602060 }
@@ -2093,7 +2093,7 @@ void CheckOtherImpl::checkConstPointer()
20932093 continue ;
20942094 if (Token::simpleMatch (parent, " -" ) && parent->valueType () && parent->valueType ()->pointer == 0 )
20952095 continue ;
2096- if (hasIncDecPlus && (!parent->astParent () || parent->astParent ()->str () == " ;" ))
2096+ if (hasIncDecPlusMinus && (!parent->astParent () || parent->astParent ()->str () == " ;" ))
20972097 continue ;
20982098 if (Token::simpleMatch (parent, " (" ) && Token::Match (parent->astOperand1 (), " if|while" ))
20992099 continue ;
You can’t perform that action at this time.
0 commit comments