parent
6366a577f9
commit
1744cbaf66
|
@ -1611,8 +1611,7 @@ bool CheckUnusedVar::isFunctionWithoutSideEffects(const Function& func, const To
|
|||
bool sideEffectReturnFound = false;
|
||||
std::set<const Variable*> pointersToGlobals;
|
||||
for (Token* bodyToken = func.functionScope->bodyStart->next(); bodyToken != func.functionScope->bodyEnd;
|
||||
bodyToken = bodyToken->next())
|
||||
{
|
||||
bodyToken = bodyToken->next()) {
|
||||
// check variable inside function body
|
||||
const Variable* bodyVariable = bodyToken->variable();
|
||||
if (bodyVariable) {
|
||||
|
@ -1631,8 +1630,7 @@ bool CheckUnusedVar::isFunctionWithoutSideEffects(const Function& func, const To
|
|||
// check if pointer to global variable assigned to another variable (another_var = &global_var)
|
||||
if (Token::simpleMatch(bodyToken->tokAt(-1), "&") && Token::simpleMatch(bodyToken->tokAt(-2), "=")) {
|
||||
const Token* assigned_var_token = bodyToken->tokAt(-3);
|
||||
if (assigned_var_token && assigned_var_token->variable())
|
||||
{
|
||||
if (assigned_var_token && assigned_var_token->variable()) {
|
||||
pointersToGlobals.insert(assigned_var_token->variable());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue