| 2146 | } |
| 2147 | |
| 2148 | bool isWithoutSideEffects(const Token* tok, bool checkArrayAccess, bool checkReference) |
| 2149 | { |
| 2150 | if (!tok) |
| 2151 | return true; |
| 2152 | if (!tok->isCpp()) |
| 2153 | return true; |
| 2154 | |
| 2155 | while (tok && tok->astOperand2() && tok->astOperand2()->str() != "(") |
| 2156 | tok = tok->astOperand2(); |
| 2157 | if (tok && tok->varId()) { |
| 2158 | const Variable* var = tok->variable(); |
| 2159 | return var && ((!var->isClass() && (checkReference || !var->isReference())) || var->isPointer() || |
| 2160 | (checkArrayAccess ? var->isArray() || (var->isStlType() && !var->isStlType(CheckClassImpl::stl_containers_not_const)) : var->isStlType())); |
| 2161 | } |
| 2162 | return true; |
| 2163 | } |
| 2164 | |
| 2165 | bool isUniqueExpression(const Token* tok) |
| 2166 | { |
no test coverage detected