Skip to content

Commit 2c108c8

Browse files
committed
astutils.cpp: added more bailouts in isMutableExpression() [skip ci]
1 parent 41be5e9 commit 2c108c8

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

lib/astutils.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
#include <unordered_map>
4949
#include <utility>
5050

51+
#include <iostream>
52+
5153
const Token* findExpression(const nonneg int exprid,
5254
const Token* start,
5355
const Token* end,
@@ -2485,12 +2487,21 @@ bool isMutableExpression(const Token* tok)
24852487
return false;
24862488
if (tok->isLiteral() || tok->isKeyword() || tok->isStandardType() || tok->isEnumerator())
24872489
return false;
2490+
//if (Token::Match(tok, "std :: %name%"))
2491+
// return false;
2492+
//if (Token::Match(tok->previous(), "std :: %name%"))
2493+
// return false;
2494+
//if (Token::Match(tok->tokAt(-2), "std :: %name%"))
2495+
// return false;
24882496
if (Token::Match(tok, ",|;|:|]|)|}"))
24892497
return false;
24902498
if (Token::simpleMatch(tok, "[ ]"))
24912499
return false;
2492-
if (tok->previous() && tok->previous()->isKeyword() && Token::Match(tok->previous(), "%name% ("))
2500+
if (tok->previous() && tok->previous()->isKeyword() && Token::Match(tok->previous(), "%name% (")) {
2501+
//if (tok->previous() && tok->previous()->exprId() == 0 && Token::Match(tok->previous(), "%name% (")) {
2502+
//std::cout << tok->strAt(-1) << std::endl;
24932503
return false;
2504+
}
24942505
if (tok->link() && Token::Match(tok, "<|>"))
24952506
return false;
24962507
if (tok->astOperand1() && Token::simpleMatch(tok, "["))
@@ -2926,7 +2937,10 @@ static bool isExpressionChangedAt(const F& getExprTok,
29262937
if (!expr && !(tok->valueType() && tok->valueType()->pointer == 0 && tok->valueType()->reference == Reference::None))
29272938
aliased = true;
29282939
if (!aliased)
2940+
{
2941+
std::cout << tok->str() << " " << tok->exprId() << " " << exprid << " " << indirect << std::endl;
29292942
aliased = isAliasOf(tok, expr, &i);
2943+
}
29302944
if (!aliased)
29312945
return false;
29322946
i += indirect;

0 commit comments

Comments
 (0)