Skip to content

Commit 3452882

Browse files
committed
astutils.cpp: added more bailouts in isMutableExpression() [skip ci]
1 parent 31b8e7e commit 3452882

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

lib/astutils.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2458,9 +2458,11 @@ bool isMutableExpression(const Token* tok)
24582458
{
24592459
if (!tok)
24602460
return false;
2461+
if (!tok->exprId())
2462+
return false;
24612463
if (tok->isLiteral() || tok->isKeyword() || tok->isStandardType() || tok->isEnumerator())
24622464
return false;
2463-
if (Token::Match(tok, ",|;|:|]|)|}"))
2465+
if (Token::Match(tok, ",|;|:|]|)|}|::"))
24642466
return false;
24652467
if (Token::simpleMatch(tok, "[ ]"))
24662468
return false;
@@ -2847,6 +2849,8 @@ static std::function<R()> memoize(F f)
28472849
};
28482850
}
28492851

2852+
#include <iostream>
2853+
28502854
template<class F,
28512855
REQUIRES("F must be a function that returns a Token class",
28522856
std::is_convertible<decltype(std::declval<F>()()), const Token*> )>
@@ -2880,7 +2884,10 @@ static bool isExpressionChangedAt(const F& getExprTok,
28802884
if (!expr)
28812885
aliased = true;
28822886
if (!aliased)
2887+
{
2888+
std::cout << tok->str() << " " << tok->exprId() << std::endl;
28832889
aliased = isAliasOf(tok, expr, &i);
2890+
}
28842891
if (!aliased)
28852892
return false;
28862893
if (isVariableChanged(tok, indirect + i, settings, depth))

0 commit comments

Comments
 (0)