Skip to content

Commit 943c2cb

Browse files
fixup! fixup! fixup! fixup! Fix #8260 Improve check: Pointer calculation result not null
1 parent 0e32b9a commit 943c2cb

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/checkcondition.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,16 +1156,16 @@ static bool isIfConstexpr(const Token* tok) {
11561156
return Token::simpleMatch(top->astOperand1(), "if") && top->astOperand1()->isConstexpr();
11571157
}
11581158

1159-
static const Token* isPointerArithmeticAdd(const Token* tok)
1159+
static bool isPointerArithmeticAdd(const Token* tok)
11601160
{
11611161
if (!tok || tok->str() != "+" || !astIsPointer(tok))
1162-
return nullptr;
1162+
return false;
11631163

11641164
const Token* intOp = astIsPointer(tok->astOperand1()) ? tok->astOperand2() : tok->astOperand1();
11651165
if (intOp && intOp->hasKnownIntValue() && intOp->getKnownIntValue() != 0)
1166-
return tok;
1166+
return true;
11671167

1168-
return nullptr;
1168+
return false;
11691169
}
11701170

11711171
static const Token* getPointerAdditionCalcToken(const Token * const tok)
@@ -1847,7 +1847,7 @@ void CheckConditionImpl::checkPointerAdditionResultNotNull()
18471847
if (tok->isExpandedMacro())
18481848
continue;
18491849

1850-
const bool usedAsBool = astIsPointer(tok) && isUsedAsBool(tok, *mSettings);
1850+
const bool usedAsBool = astIsPointer(tok) && isUsedAsBool(tok, mSettings);
18511851
if (!tok->isComparisonOp() && !usedAsBool)
18521852
continue;
18531853

0 commit comments

Comments
 (0)