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

Function isAliasModified

lib/vf_analyzers.cpp:244–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242 }
243
244 virtual Action isAliasModified(const Token* tok, int indirect = -1) const {
245 // Lambda function call
246 if (Token::Match(tok, "%var% ("))
247 // TODO: Check if modified in the lambda function
248 return Action::Invalid;
249 if (indirect == -1) {
250 indirect = 0;
251 if (const ValueType* vt = tok->valueType()) {
252 indirect = vt->pointer;
253 if (vt->type == ValueType::ITERATOR)
254 ++indirect;
255 const Token* tok2 = tok;
256 while (Token::simpleMatch(tok2->astParent(), "[")) {
257 tok2 = tok2->astParent();
258 --indirect;
259 }
260 indirect = std::max(indirect, 0);
261 }
262 }
263 for (int i = 0; i <= indirect; ++i)
264 if (isVariableChanged(tok, i, getSettings()))
265 return Action::Invalid;
266 return Action::None;
267 }
268
269 virtual Action isThisModified(const Token* tok) const {
270 if (isThisChanged(tok, 0, getSettings()))

Callers 2

analyzeTokenFunction · 0.85
isAliasModifiedMethod · 0.85

Calls 3

isVariableChangedFunction · 0.85
astParentMethod · 0.80
simpleMatchFunction · 0.70

Tested by

no test coverage detected