| 1824 | } |
| 1825 | |
| 1826 | static bool isConstPointerVariable(const Variable* p, const Settings& settings) |
| 1827 | { |
| 1828 | const int indirect = p->isArray() ? p->dimensions().size() : 1; |
| 1829 | const Token* start = getVariableChangedStart(p); |
| 1830 | while (const Token* tok = |
| 1831 | findVariableChanged(start, p->scope()->bodyEnd, indirect, p->declarationId(), false, settings)) { |
| 1832 | if (p->isReference()) |
| 1833 | return false; |
| 1834 | // Assigning a pointer through another pointer may still be const |
| 1835 | if (!Token::simpleMatch(tok->astParent(), "=")) |
| 1836 | return false; |
| 1837 | if (!astIsLHS(tok)) |
| 1838 | return false; |
| 1839 | start = tok->next(); |
| 1840 | } |
| 1841 | return true; |
| 1842 | } |
| 1843 | |
| 1844 | namespace { |
| 1845 | struct CompareVariables { |
no test coverage detected