@@ -1170,14 +1170,14 @@ void TemplateSimplifier::useDefaultArgumentValues(TokenAndName &declaration)
11701170 while (it != eq.cend ()) {
11711171 // check for end
11721172 if (!it->end ) {
1173- if (mSettings .debugwarnings && mErrorLogger && mSettings .severity .isEnabled (Severity::debug)) {
1173+ if (mSettings .debugwarnings && mSettings .severity .isEnabled (Severity::debug)) {
11741174 const std::list<const Token*> locationList (1 , it->eq );
11751175 const ErrorMessage errmsg (locationList, &mTokenizer .list ,
11761176 Severity::debug,
11771177 " noparamend" ,
11781178 " TemplateSimplifier couldn't find end of template parameter." ,
11791179 Certainty::normal);
1180- mErrorLogger -> reportErr (errmsg);
1180+ mErrorLogger . reportErr (errmsg);
11811181 }
11821182 break ;
11831183 }
@@ -3078,7 +3078,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
30783078 numberOfTemplateInstantiations = mTemplateInstantiations .size ();
30793079 ++recursiveCount;
30803080 if (recursiveCount > mSettings .maxTemplateRecursion ) {
3081- if (mErrorLogger && mSettings .severity .isEnabled (Severity::information)) {
3081+ if (mSettings .severity .isEnabled (Severity::information)) {
30823082 std::list<std::string> typeStringsUsedInTemplateInstantiation;
30833083 const std::string typeForNewName = templateDeclaration.name () + " <" + getNewName (instantiation.token (), typeStringsUsedInTemplateInstantiation) + " >" ;
30843084
@@ -3091,7 +3091,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
30913091 + std::to_string (mSettings .maxTemplateRecursion )
30923092 + " ) reached for template '" +typeForNewName+" '. You might want to limit Cppcheck recursion." ,
30933093 Certainty::normal);
3094- mErrorLogger -> reportErr (errmsg);
3094+ mErrorLogger . reportErr (errmsg);
30953095 }
30963096
30973097 // bail out..
@@ -3159,8 +3159,8 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
31593159 continue ;
31603160
31613161 Token * const tok2 = instantiation.token ();
3162- if (mErrorLogger && !mTokenList .getFiles ().empty ())
3163- mErrorLogger -> reportProgress (mTokenList .getFiles ()[0 ], " TemplateSimplifier::simplifyTemplateInstantiations()" , tok2->progressValue ());
3162+ if (!mTokenList .getFiles ().empty ())
3163+ mErrorLogger . reportProgress (mTokenList .getFiles ()[0 ], " TemplateSimplifier::simplifyTemplateInstantiations()" , tok2->progressValue ());
31643164
31653165 if (maxtime > 0 && std::time (nullptr ) > maxtime) {
31663166 if (mSettings .debugwarnings ) {
@@ -3171,7 +3171,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
31713171 " Template instantiation maximum time exceeded" ,
31723172 " templateMaxTime" ,
31733173 Certainty::normal);
3174- mErrorLogger -> reportErr (errmsg);
3174+ mErrorLogger . reportErr (errmsg);
31753175 }
31763176 return false ;
31773177 }
@@ -3201,10 +3201,10 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
32013201
32023202 if ((typeForNewName.empty () && !templateDeclaration.isVariadic ()) ||
32033203 (!typeParametersInDeclaration.empty () && !instantiateMatch (tok2, typeParametersInDeclaration.size (), templateDeclaration.isVariadic (), nullptr ))) {
3204- if (printDebug && mErrorLogger ) {
3204+ if (printDebug) {
32053205 std::list<const Token *> callstack (1 , tok2);
3206- mErrorLogger -> reportErr (ErrorMessage (callstack, &mTokenList , Severity::debug, " templateInstantiation" ,
3207- " Failed to instantiate template \" " + instantiation.name () + " \" . The checking continues anyway." , Certainty::normal));
3206+ mErrorLogger . reportErr (ErrorMessage (callstack, &mTokenList , Severity::debug, " templateInstantiation" ,
3207+ " Failed to instantiate template \" " + instantiation.name () + " \" . The checking continues anyway." , Certainty::normal));
32083208 }
32093209 if (typeForNewName.empty ())
32103210 continue ;
@@ -3229,8 +3229,8 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
32293229 // TODO: remove the specialized check and handle all uninstantiated templates someday.
32303230 if (!instantiated && specialized) {
32313231 auto * tok2 = const_cast <Token *>(templateDeclaration.nameToken ());
3232- if (mErrorLogger && !mTokenList .getFiles ().empty ())
3233- mErrorLogger -> reportProgress (mTokenList .getFiles ()[0 ], " TemplateSimplifier::simplifyTemplateInstantiations()" , tok2->progressValue ());
3232+ if (!mTokenList .getFiles ().empty ())
3233+ mErrorLogger . reportProgress (mTokenList .getFiles ()[0 ], " TemplateSimplifier::simplifyTemplateInstantiations()" , tok2->progressValue ());
32343234
32353235 if (maxtime > 0 && std::time (nullptr ) > maxtime) {
32363236 if (mSettings .debugwarnings ) {
@@ -3241,7 +3241,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
32413241 " Template instantiation maximum time exceeded" ,
32423242 " templateMaxTime" ,
32433243 Certainty::normal);
3244- mErrorLogger -> reportErr (errmsg);
3244+ mErrorLogger . reportErr (errmsg);
32453245 }
32463246 return false ;
32473247 }
@@ -3278,10 +3278,10 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
32783278 std::string typeForNewName = getNewName (tok2, typeStringsUsedInTemplateInstantiation);
32793279
32803280 if (typeForNewName.empty ()) {
3281- if (printDebug && mErrorLogger ) {
3281+ if (printDebug) {
32823282 std::list<const Token *> callstack (1 , tok2);
3283- mErrorLogger -> reportErr (ErrorMessage (callstack, &mTokenList , Severity::debug, " templateInstantiation" ,
3284- " Failed to instantiate template \" " + templateDeclaration.name () + " \" . The checking continues anyway." , Certainty::normal));
3283+ mErrorLogger . reportErr (ErrorMessage (callstack, &mTokenList , Severity::debug, " templateInstantiation" ,
3284+ " Failed to instantiate template \" " + templateDeclaration.name () + " \" . The checking continues anyway." , Certainty::normal));
32853285 }
32863286 return false ;
32873287 }
@@ -3972,14 +3972,14 @@ void TemplateSimplifier::simplifyTemplates(const std::time_t maxtime)
39723972 }
39733973
39743974 if (passCount == passCountMax) {
3975- if (mSettings .debugwarnings && mErrorLogger ) {
3975+ if (mSettings .debugwarnings ) {
39763976 const std::list<const Token*> locationList (1 , mTokenList .front ());
39773977 const ErrorMessage errmsg (locationList, &mTokenizer .list ,
39783978 Severity::debug,
39793979 " debug" ,
39803980 " TemplateSimplifier: pass count limit hit before simplifications were finished." ,
39813981 Certainty::normal);
3982- mErrorLogger -> reportErr (errmsg);
3982+ mErrorLogger . reportErr (errmsg);
39833983 }
39843984 }
39853985
0 commit comments