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

Method validateVariables

lib/symboldatabase.cpp:2189–2202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2187}
2188
2189void SymbolDatabase::validateVariables() const
2190{
2191 for (auto iter = mVariableList.cbegin(); iter!=mVariableList.cend(); ++iter) {
2192 const Variable * const var = *iter;
2193 if (var) {
2194 if (!var->scope()) {
2195 const Function* function = getFunctionForArgumentvariable(var);
2196 if (!var->isArgument() || (!function || function->hasBody())) { // variables which only appear in a function declaration do not have a scope
2197 throw InternalError(var->nameToken(), "Analysis failed (variable without scope). If the code is valid then please report this failure.", InternalError::INTERNAL);
2198 }
2199 }
2200 }
2201 }
2202}
2203
2204bool SymbolDatabase::isVariableWithoutSideEffects(const Variable& var, const Type* type) const
2205{

Callers

nothing calls this directly

Calls 3

scopeMethod · 0.80
nameTokenMethod · 0.45

Tested by

no test coverage detected