used to check if an argument to a function might depend on another argument
| 1302 | |
| 1303 | // used to check if an argument to a function might depend on another argument |
| 1304 | static bool mayDependOn(const ValueType *other, const ValueType *original) |
| 1305 | { |
| 1306 | if (!other || !original) |
| 1307 | return false; |
| 1308 | |
| 1309 | // other must be pointer |
| 1310 | if (!other->pointer) |
| 1311 | return false; |
| 1312 | |
| 1313 | // must be same underlying type |
| 1314 | if (other->type != original->type) |
| 1315 | return false; |
| 1316 | |
| 1317 | const int otherPtr = other->pointer + (other->reference == Reference::LValue ? 1 : 0); |
| 1318 | const int originalPtr = original->pointer; |
| 1319 | |
| 1320 | if (otherPtr == originalPtr) { |
| 1321 | // if other is not const than original may be copied to other |
| 1322 | return !other->isConst(otherPtr); |
| 1323 | } |
| 1324 | |
| 1325 | // other may be reassigned to original |
| 1326 | return otherPtr > originalPtr; |
| 1327 | } |
| 1328 | |
| 1329 | static bool isOnlyUsedInCurrentScope(const Variable* var, const Token *tok, const Scope* scope) |
| 1330 | { |
no test coverage detected