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

Function addToErrorPath

lib/infer.cpp:240–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240static void addToErrorPath(ValueFlow::Value& value, const std::vector<const ValueFlow::Value*>& refs)
241{
242 std::unordered_set<const Token*> locations;
243 for (const ValueFlow::Value* ref : refs) {
244 if (ref->condition && !value.condition)
245 value.condition = ref->condition;
246 std::copy_if(ref->errorPath.cbegin(),
247 ref->errorPath.cend(),
248 std::back_inserter(value.errorPath),
249 [&](const ErrorPathItem& e) {
250 return locations.insert(e.first).second;
251 });
252 std::copy_if(ref->debugPath.cbegin(),
253 ref->debugPath.cend(),
254 std::back_inserter(value.debugPath),
255 [&](const ErrorPathItem& e) {
256 return locations.insert(e.first).second;
257 });
258 }
259}
260
261static void setValueKind(ValueFlow::Value& value, const std::vector<const ValueFlow::Value*>& refs)
262{

Callers 1

inferFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected