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

Function isEscapeScope

lib/valueflow.cpp:368–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366}
367
368static bool isEscapeScope(const Token* tok, const Library& library, bool unknown = false)
369{
370 if (!Token::simpleMatch(tok, "{"))
371 return false;
372 // TODO this search for termTok in all subscopes. It should check the end of the scope.
373 const Token* termTok = Token::findmatch(tok, "return|continue|break|throw|goto", tok->link());
374 if (termTok && termTok->scope() == tok->scope())
375 return true;
376 std::string unknownFunction;
377 if (library.isScopeNoReturn(tok->link(), &unknownFunction))
378 return unknownFunction.empty() || unknown;
379 return false;
380}
381
382void ValueFlow::combineValueProperties(const ValueFlow::Value &value1, const ValueFlow::Value &value2, ValueFlow::Value &result)
383{

Callers 1

Calls 4

scopeMethod · 0.80
simpleMatchFunction · 0.70
isScopeNoReturnMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected