@@ -304,15 +304,12 @@ Library::Container::Yield astContainerYield(const Token* tok, const Token** ftok
304304 return tok->valueType ()->container ->getYield (ftok2->str ());
305305}
306306
307- Library::Container::Yield astFunctionYield (const Token* tok, const Settings* settings, const Token** ftok)
307+ Library::Container::Yield astFunctionYield (const Token* tok, const Settings& settings, const Token** ftok)
308308{
309309 if (!tok)
310310 return Library::Container::Yield::NO_YIELD ;
311311
312- if (!settings)
313- return Library::Container::Yield::NO_YIELD ;
314-
315- const auto * function = settings->library .getFunction (tok);
312+ const auto * function = settings.library .getFunction (tok);
316313 if (!function)
317314 return Library::Container::Yield::NO_YIELD ;
318315
@@ -635,7 +632,7 @@ static std::vector<const Token*> getParentMembers(const Token* tok)
635632 return result;
636633}
637634
638- const Token* getParentLifetime (const Token* tok, const Library* library)
635+ const Token* getParentLifetime (const Token* tok, const Library& library)
639636{
640637 std::vector<const Token*> members = getParentMembers (tok);
641638 if (members.size () < 2 )
@@ -647,7 +644,7 @@ const Token* getParentLifetime(const Token* tok, const Library* library)
647644 return var->isLocal () || var->isArgument ();
648645 if (Token::simpleMatch (tok2, " [" ))
649646 return true ;
650- return isTemporary (tok2, library);
647+ return isTemporary (tok2, & library);
651648 });
652649 if (it == members.rend ())
653650 return tok;
@@ -2127,18 +2124,18 @@ bool isUniqueExpression(const Token* tok)
21272124 return isUniqueExpression (tok->astOperand2 ());
21282125}
21292126
2130- static bool isEscaped (const Token* tok, bool functionsScope, const Library* library)
2127+ static bool isEscaped (const Token* tok, bool functionsScope, const Library& library)
21312128{
2132- if (library && library-> isnoreturn (tok))
2129+ if (library. isnoreturn (tok))
21332130 return true ;
21342131 if (functionsScope)
21352132 return Token::simpleMatch (tok, " throw" );
21362133 return Token::Match (tok, " return|throw" );
21372134}
21382135
2139- static bool isEscapedOrJump (const Token* tok, bool functionsScope, const Library* library)
2136+ static bool isEscapedOrJump (const Token* tok, bool functionsScope, const Library& library)
21402137{
2141- if (library && library-> isnoreturn (tok))
2138+ if (library. isnoreturn (tok))
21422139 return true ;
21432140 if (functionsScope)
21442141 return Token::simpleMatch (tok, " throw" );
@@ -2162,7 +2159,7 @@ bool isEscapeFunction(const Token* ftok, const Library* library)
21622159 return false ;
21632160}
21642161
2165- static bool hasNoreturnFunction (const Token* tok, const Library* library, const Token** unknownFunc)
2162+ static bool hasNoreturnFunction (const Token* tok, const Library& library, const Token** unknownFunc)
21662163{
21672164 if (!tok)
21682165 return false ;
@@ -2176,12 +2173,12 @@ static bool hasNoreturnFunction(const Token* tok, const Library* library, const
21762173 return true ;
21772174 if (function->isAttributeNoreturn ())
21782175 return true ;
2179- } else if (library && library-> isnoreturn (ftok)) {
2176+ } else if (library. isnoreturn (ftok)) {
21802177 return true ;
21812178 } else if (Token::Match (ftok, " exit|abort" )) {
21822179 return true ;
21832180 }
2184- if (unknownFunc && !function && library && library-> functions .count (library-> getFunctionName (ftok)) == 0 )
2181+ if (unknownFunc && !function && library. functions .count (library. getFunctionName (ftok)) == 0 )
21852182 *unknownFunc = ftok;
21862183 return false ;
21872184 }
@@ -2192,7 +2189,7 @@ static bool hasNoreturnFunction(const Token* tok, const Library* library, const
21922189 return false ;
21932190}
21942191
2195- bool isReturnScope (const Token* const endToken, const Library* library, const Token** unknownFunc, bool functionScope)
2192+ bool isReturnScope (const Token* const endToken, const Library& library, const Token** unknownFunc, bool functionScope)
21962193{
21972194 if (!endToken || endToken->str () != " }" )
21982195 return false ;
@@ -3005,9 +3002,9 @@ namespace {
30053002 };
30063003
30073004 struct ExpressionChangedSkipDeadCode {
3008- const Library* library;
3005+ const Library& library;
30093006 const std::function<std::vector<MathLib::bigint>(const Token* tok)>* evaluate;
3010- ExpressionChangedSkipDeadCode (const Library* library,
3007+ ExpressionChangedSkipDeadCode (const Library& library,
30113008 const std::function<std::vector<MathLib::bigint>(const Token* tok)>& evaluate)
30123009 : library(library), evaluate(&evaluate)
30133010 {}
@@ -3036,7 +3033,7 @@ const Token* findExpressionChangedSkipDeadCode(const Token* expr,
30363033 int depth)
30373034{
30383035 return findExpressionChangedImpl (
3039- expr, start, end, settings, depth, ExpressionChangedSkipDeadCode{& settings->library , evaluate});
3036+ expr, start, end, settings, depth, ExpressionChangedSkipDeadCode{settings->library , evaluate});
30403037}
30413038
30423039const Token* getArgumentStart (const Token* ftok)
0 commit comments