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

Method ExpressionAnalyzer

lib/vf_analyzers.cpp:1251–1265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1249 bool uniqueExprId{};
1250
1251 ExpressionAnalyzer(const Token* e, ValueFlow::Value val, const Settings& s)
1252 : SingleValueFlowAnalyzer(std::move(val), s),
1253 expr(e)
1254 {
1255
1256 assert(e && e->exprId() != 0 && "Not a valid expression");
1257 dependOnThis = exprDependsOnThis(expr);
1258 setupExprVarIds(expr);
1259 if (value.isSymbolicValue()) {
1260 dependOnThis |= exprDependsOnThis(value.tokvalue);
1261 setupExprVarIds(value.tokvalue);
1262 }
1263 uniqueExprId =
1264 expr->isUniqueExprId() && (Token::Match(expr, "%cop%") || !isVariableChanged(expr, 0, s));
1265 }
1266
1267 static bool nonLocal(const Variable* var, bool deref) {
1268 return !var || (!var->isLocal() && !var->isArgument()) || (deref && var->isArgument() && var->isPointer()) ||

Callers

nothing calls this directly

Calls 2

exprDependsOnThisFunction · 0.85
isVariableChangedFunction · 0.85

Tested by

no test coverage detected