Skip to content

Commit 47f26cc

Browse files
Update astutils.cpp
1 parent f33d653 commit 47f26cc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/astutils.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,8 +2617,11 @@ bool isVariableChangedByFunctionCall(const Token *tok, int indirect, const Setti
26172617
return false;
26182618
}
26192619

2620-
static bool hasOverloadedMemberAccess(const Token* varTok)
2620+
static bool hasOverloadedMemberAccess(const Token* tok)
26212621
{
2622+
if (!Token::simpleMatch(tok, ".))
2623+
return false;
2624+
const Token* varTok = tok->astOperand2();
26222625
return !varTok || !varTok->variable() || !varTok->variable()->valueType() || varTok->variable()->valueType()->pointer == 0;
26232626
}
26242627
@@ -2636,7 +2639,7 @@ bool isVariableChanged(const Token *tok, int indirect, const Settings &settings,
26362639
(Token::simpleMatch(tok2->astParent(), ".") && !Token::Match(tok2->astParent()->astParent(), "[(,]")) ||
26372640
(tok2->astParent() && tok2->astParent()->isUnaryOp("&") && Token::simpleMatch(tok2->astParent()->astParent(), ".") && tok2->astParent()->astParent()->originalName()=="->") ||
26382641
(Token::simpleMatch(tok2->astParent(), "[") && tok2 == tok2->astParent()->astOperand1())) {
2639-
if (tok2->astParent() && (tok2->astParent()->isUnaryOp("*") || (astIsLHS(tok2) && tok2->astParent()->originalName() == "->" && !hasOverloadedMemberAccess(tok2->astOperand2()))))
2642+
if (tok2->astParent() && (tok2->astParent()->isUnaryOp("*") || (astIsLHS(tok2) && tok2->astParent()->originalName() == "->" && !hasOverloadedMemberAccess(tok2))))
26402643
derefs++;
26412644
if (derefs > indirect)
26422645
break;

0 commit comments

Comments
 (0)