Skip to content

Commit

Permalink
Fix hang in hasBorrowingVariables()
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Aug 16, 2023
1 parent 6a263ba commit 71a9139
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/valueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4256,13 +4256,14 @@ struct LifetimeStore {
}
};

static bool hasBorrowingVariables(const std::list<Variable>& vars, const std::vector<const Token*>& args, int depth = 10)
static bool hasBorrowingVariables(const std::list<Variable>& vars, const std::vector<const Token*>& args/*, std::set<const Scope*>& scopes*/, int depth = 10)
{
if (depth < 0)
return false;
return true;
return std::any_of(vars.cbegin(), vars.cend(), [&](const Variable& var) {
const ValueType* vt = var.valueType();
if (vt) {
if (var.isStatic())
return false;
if (const ValueType* vt = var.valueType()) {
if (vt->pointer > 0 &&
std::none_of(args.begin(), args.end(), [vt](const Token* arg) {
return arg->valueType() && arg->valueType()->type == vt->type;
Expand Down

0 comments on commit 71a9139

Please sign in to comment.