Skip to content

Commit

Permalink
Do not pass ProbeArgs entries by value in predicate function
Browse files Browse the repository at this point in the history
Fixes alert reported by lgtm:
This parameter of type pair<...> is 168 bytes - consider
passing a const pointer/reference instead.
  • Loading branch information
gedimitr authored and fbs committed Mar 14, 2022
1 parent f94e018 commit 275f520
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ast/passes/field_analyser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ void FieldAnalyser::visit(AssignVarStatement &assignment)

bool FieldAnalyser::compare_args(const ProbeArgs &args1, const ProbeArgs &args2)
{
auto pred = [](auto a, auto b) { return a.first == b.first; };
using ProbeArgsValue = ProbeArgs::value_type;
auto pred = [](const ProbeArgsValue &a, const ProbeArgsValue &b) {
return a.first == b.first;
};

return args1.size() == args2.size() &&
std::equal(args1.begin(), args1.end(), args2.begin(), pred);
Expand Down

0 comments on commit 275f520

Please sign in to comment.