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

Method replace

lib/programmemory.cpp:229–244  ·  view source on GitHub ↗

NOLINTNEXTLINE(performance-unnecessary-value-param) - technically correct but we are moving the given values

Source from the content-addressed store, hash-verified

227
228// NOLINTNEXTLINE(performance-unnecessary-value-param) - technically correct but we are moving the given values
229void ProgramMemory::replace(ProgramMemory pm, bool skipUnknown)
230{
231 if (pm.empty())
232 return;
233
234 copyOnWrite();
235
236 for (auto&& p : (*pm.mValues)) {
237 if (skipUnknown) {
238 auto it = mValues->find(p.first);
239 if (it != mValues->end() && it->second.isUninitValue())
240 continue;
241 }
242 (*mValues)[p.first] = std::move(p.second);
243 }
244}
245
246void ProgramMemory::copyOnWrite()
247{

Callers 2

addStateMethod · 0.45
getProgramMemoryFunction · 0.45

Calls 4

getExpressionIdMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected