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

Function isMoveOrForward

lib/vf_analyzers.cpp:191–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189 }
190
191 static ValueFlow::Value::MoveKind isMoveOrForward(const Token* tok)
192 {
193 if (!tok)
194 return ValueFlow::Value::MoveKind::NonMovedVariable;
195 const Token* parent = tok->astParent();
196 if (!Token::simpleMatch(parent, "("))
197 return ValueFlow::Value::MoveKind::NonMovedVariable;
198 const Token* ftok = parent->astOperand1();
199 if (!ftok)
200 return ValueFlow::Value::MoveKind::NonMovedVariable;
201 if (Token::simpleMatch(ftok->astOperand1(), "std :: move"))
202 return ValueFlow::Value::MoveKind::MovedVariable;
203 if (Token::simpleMatch(ftok->astOperand1(), "std :: forward"))
204 return ValueFlow::Value::MoveKind::ForwardedVariable;
205 // TODO: Check for cast
206 return ValueFlow::Value::MoveKind::NonMovedVariable;
207 }
208
209 virtual Action isModified(const Token* tok) const {
210 const ValueFlow::Value* value = getValue(tok);

Callers 1

isModifiedFunction · 0.85

Calls 3

astParentMethod · 0.80
astOperand1Method · 0.80
simpleMatchFunction · 0.70

Tested by

no test coverage detected