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

Function isGlobalModified

lib/vf_analyzers.cpp:421–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419 }
420
421 Action isGlobalModified(const Token* tok) const
422 {
423 if (tok->function()) {
424 if (!tok->function()->isConstexpr() && !isConstFunctionCall(tok, getSettings().library))
425 return Action::Invalid;
426 } else if (getSettings().library.getFunction(tok)) {
427 // Assume library function doesn't modify user-global variables
428 return Action::None;
429 } else if (Token::simpleMatch(tok->astParent(), ".") && astIsContainer(tok->astParent()->astOperand1())) {
430 // Assume container member function doesn't modify user-global variables
431 return Action::None;
432 } else if (tok->tokType() == Token::eType && astIsPrimitive(tok->next())) {
433 // Function cast does not modify global variables
434 return Action::None;
435 } else if (!tok->isKeyword() && Token::Match(tok, "%name% (")) {
436 return Action::Invalid;
437 }
438 return Action::None;
439 }
440
441 static const std::string& invertAssign(const std::string& assign)
442 {

Callers 2

analyzeMatchFunction · 0.85
analyzeFunction · 0.85

Calls 10

isConstFunctionCallFunction · 0.85
astIsContainerFunction · 0.85
astIsPrimitiveFunction · 0.85
astParentMethod · 0.80
astOperand1Method · 0.80
nextMethod · 0.80
simpleMatchFunction · 0.70
functionMethod · 0.45
getFunctionMethod · 0.45
isKeywordMethod · 0.45

Tested by

no test coverage detected