Skip to content

Commit a236dc8

Browse files
Update checkother.cpp [skip ci]
1 parent 77ceb53 commit a236dc8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎lib/checkother.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)