| 185 | } |
| 186 | |
| 187 | static bool isVarUsedInTree(const Token *tok, nonneg int varid) |
| 188 | { |
| 189 | if (!tok) |
| 190 | return false; |
| 191 | std::deque<const Token*> nodes{ tok }; |
| 192 | while (!nodes.empty()) { |
| 193 | const Token* node = nodes.front(); |
| 194 | if (node->varId() == varid) |
| 195 | return true; |
| 196 | if (node->str() != "(" || !Token::simpleMatch(node->astOperand1(), "sizeof")) { |
| 197 | if (node->astOperand1()) |
| 198 | nodes.emplace_back(node->astOperand1()); |
| 199 | if (node->astOperand2()) |
| 200 | nodes.emplace_back(node->astOperand2()); |
| 201 | } |
| 202 | nodes.pop_front(); |
| 203 | } |
| 204 | return false; |
| 205 | } |
| 206 | |
| 207 | static bool isPointerReleased(const Token *startToken, const Token *endToken, nonneg int varid) |
| 208 | { |
no test coverage detected