MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / removeAdjacentValues

Function removeAdjacentValues

lib/token.cpp:2102–2116  ·  view source on GitHub ↗

NOLINTNEXTLINE(performance-unnecessary-value-param) - false positive

Source from the content-addressed store, hash-verified

2100template<class Iterator>
2101// NOLINTNEXTLINE(performance-unnecessary-value-param) - false positive
2102static ValueIterator removeAdjacentValues(std::list<ValueFlow::Value>& values, ValueIterator x, Iterator start, Iterator last)
2103{
2104 if (!isAdjacent(*x, **start))
2105 return std::next(x);
2106 auto it = std::adjacent_find(start, last, [](ValueIterator x, ValueIterator y) {
2107 return !isAdjacent(*x, *y);
2108 });
2109 if (it == last)
2110 it--;
2111 (*it)->bound = x->bound;
2112 std::for_each(std::move(start), std::move(it), [&](ValueIterator y) {
2113 values.erase(y);
2114 });
2115 return values.erase(x);
2116}
2117
2118static void mergeAdjacent(std::list<ValueFlow::Value>& values)
2119{

Callers 1

mergeAdjacentFunction · 0.85

Calls 3

isAdjacentFunction · 0.85
nextFunction · 0.85
eraseMethod · 0.45

Tested by

no test coverage detected