Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
pfultz2 committed May 20, 2024
1 parent 77068f9 commit a84b9f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/astutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2454,7 +2454,7 @@ static bool isMutableExpression(const Token* tok)
if (const Variable* var = tok->variable()) {
if (var->nameToken() == tok)
return false;
if(!var->isPointer() && var->isConst())
if (!var->isPointer() && var->isConst())
return false;
}
return true;
Expand Down Expand Up @@ -2623,8 +2623,8 @@ bool isVariableChanged(const Token *tok, int indirect, const Settings &settings,
return true;
// Check if assigning to a non-const lvalue
const Variable * var = getLHSVariable(tok2->astParent());
if (var && var->isReference() && !var->isConst() &&
var->nameToken() && var->nameToken()->next() == tok2->astParent()) {
if (var && var->isReference() && !var->isConst() && var->nameToken() &&
var->nameToken()->next() == tok2->astParent()) {
if (!var->isLocal() || isVariableChanged(var, settings, depth - 1))
return true;
}
Expand Down
10 changes: 5 additions & 5 deletions lib/checkother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1461,15 +1461,15 @@ static const Token* getVariableChangedStart(const Variable* p)
static bool isConstPointerVariable(const Variable* p, const Settings& settings)
{
const int indirect = p->isArray() ? p->dimensions().size() : 1;
const Token *start = getVariableChangedStart(p);
while (const Token* tok = findVariableChanged(start, p->scope()->bodyEnd, indirect, p->declarationId(), false, settings))
{
if(p->isReference())
const Token* start = getVariableChangedStart(p);
while (const Token* tok =
findVariableChanged(start, p->scope()->bodyEnd, indirect, p->declarationId(), false, settings)) {
if (p->isReference())
return false;
// Assigning a pointer through another pointer may still be const
if (!Token::simpleMatch(tok->astParent(), "="))
return false;
if(!astIsLHS(tok))
if (!astIsLHS(tok))
return false;
start = tok->next();
}
Expand Down

0 comments on commit a84b9f4

Please sign in to comment.