From 275f520f14a0ae03c514061b771adfdcca4a85b5 Mon Sep 17 00:00:00 2001 From: Gerasimos Dimitriadis Date: Sun, 13 Mar 2022 22:25:39 +0000 Subject: [PATCH] Do not pass ProbeArgs entries by value in predicate function Fixes alert reported by lgtm: This parameter of type pair<...> is 168 bytes - consider passing a const pointer/reference instead. --- src/ast/passes/field_analyser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ast/passes/field_analyser.cpp b/src/ast/passes/field_analyser.cpp index 06d964e03af7..ec35a4d314e7 100644 --- a/src/ast/passes/field_analyser.cpp +++ b/src/ast/passes/field_analyser.cpp @@ -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);