| 475 | } |
| 476 | |
| 477 | std::list<CTU::FileInfo::UnsafeUsage> CTU::getUnsafeUsage(const Tokenizer &tokenizer, const Settings &settings, bool (*isUnsafeUsage)(const Settings &settings, const Token *argtok, CTU::FileInfo::Value *value)) |
| 478 | { |
| 479 | std::list<CTU::FileInfo::UnsafeUsage> unsafeUsage; |
| 480 | |
| 481 | // Parse all functions in TU |
| 482 | const SymbolDatabase * const symbolDatabase = tokenizer.getSymbolDatabase(); |
| 483 | |
| 484 | for (const Scope &scope : symbolDatabase->scopeList) { |
| 485 | if (!scope.isExecutable() || scope.type != ScopeType::eFunction || !scope.function) |
| 486 | continue; |
| 487 | const Function *const function = scope.function; |
| 488 | |
| 489 | // "Unsafe" functions unconditionally reads data before it is written.. |
| 490 | for (int argnr = 0; argnr < function->argCount(); ++argnr) { |
| 491 | for (const std::pair<const Token *, CTU::FileInfo::Value> &v : getUnsafeFunction(settings, &scope, argnr, isUnsafeUsage)) { |
| 492 | const Token *tok = v.first; |
| 493 | const MathLib::bigint val = v.second.value; |
| 494 | unsafeUsage.emplace_back(CTU::getFunctionId(tokenizer, function), argnr+1, tok->str(), CTU::FileInfo::Location(tokenizer,tok), val); |
| 495 | } |
| 496 | } |
| 497 | } |
| 498 | |
| 499 | return unsafeUsage; |
| 500 | } |
| 501 | |
| 502 | static bool findPath(const std::string &callId, |
| 503 | nonneg int callArgNr, |
nothing calls this directly
no test coverage detected