5252#include < unordered_set>
5353// ---------------------------------------------------------------------------
5454
55- SymbolDatabase::SymbolDatabase (Tokenizer& tokenizer, const Settings& settings, ErrorLogger* errorLogger)
55+ SymbolDatabase::SymbolDatabase (Tokenizer& tokenizer, const Settings& settings, ErrorLogger& errorLogger)
5656 : mTokenizer(tokenizer), mSettings(settings), mErrorLogger(errorLogger)
5757{
5858 if (!mTokenizer .tokens ())
@@ -169,10 +169,9 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
169169 // find all scopes
170170 for (const Token *tok = mTokenizer .tokens (); tok; tok = tok ? tok->next () : nullptr ) {
171171 // #5593 suggested to add here:
172- if (mErrorLogger )
173- mErrorLogger ->reportProgress (mTokenizer .list .getSourceFilePath (),
174- " SymbolDatabase" ,
175- tok->progressValue ());
172+ mErrorLogger .reportProgress (mTokenizer .list .getSourceFilePath (),
173+ " SymbolDatabase" ,
174+ tok->progressValue ());
176175 // Locate next class
177176 if ((tok->isCpp () && tok->isKeyword () &&
178177 ((Token::Match (tok, " class|struct|union|namespace ::| %name% final| {|:|::|<" ) &&
@@ -2087,14 +2086,14 @@ void SymbolDatabase::validateExecutableScopes() const
20872086 for (std::size_t i = 0 ; i < functions; ++i) {
20882087 const Scope* const scope = functionScopes[i];
20892088 const Function* const function = scope->function ;
2090- if (mErrorLogger && scope->isExecutable () && !function) {
2089+ if (scope->isExecutable () && !function) {
20912090 const std::list<const Token*> callstack (1 , scope->classDef );
20922091 const std::string msg = std::string (" Executable scope '" ) + scope->classDef ->str () + " ' with unknown function." ;
20932092 const ErrorMessage errmsg (callstack, &mTokenizer .list , Severity::debug,
20942093 " symbolDatabaseWarning" ,
20952094 msg,
20962095 Certainty::normal);
2097- mErrorLogger -> reportErr (errmsg);
2096+ mErrorLogger . reportErr (errmsg);
20982097 }
20992098 }
21002099}
@@ -2152,7 +2151,7 @@ void SymbolDatabase::debugSymbolDatabase() const
21522151 for (const Token* tok = mTokenizer .list .front (); tok != mTokenizer .list .back (); tok = tok->next ()) {
21532152 if (tok->astParent () && tok->astParent ()->getTokenDebug () == tok->getTokenDebug ())
21542153 continue ;
2155- if (mErrorLogger && tok->getTokenDebug () == TokenDebug::ValueType) {
2154+ if (tok->getTokenDebug () == TokenDebug::ValueType) {
21562155
21572156 std::string msg = " Value type is " ;
21582157 ErrorPath errorPath;
@@ -2164,7 +2163,7 @@ void SymbolDatabase::debugSymbolDatabase() const
21642163 msg += " missing" ;
21652164 }
21662165 errorPath.emplace_back (tok, " " );
2167- mErrorLogger -> reportErr (
2166+ mErrorLogger . reportErr (
21682167 {errorPath, &mTokenizer .list , Severity::debug, " valueType" , msg, CWE{0 }, Certainty::normal});
21692168 }
21702169 }
@@ -3584,27 +3583,27 @@ std::string Type::name() const
35843583
35853584void SymbolDatabase::debugMessage (const Token *tok, const std::string &type, const std::string &msg) const
35863585{
3587- if (tok && mSettings .debugwarnings && mErrorLogger ) {
3586+ if (tok && mSettings .debugwarnings ) {
35883587 const std::list<const Token*> locationList (1 , tok);
35893588 const ErrorMessage errmsg (locationList, &mTokenizer .list ,
35903589 Severity::debug,
35913590 type,
35923591 msg,
35933592 Certainty::normal);
3594- mErrorLogger -> reportErr (errmsg);
3593+ mErrorLogger . reportErr (errmsg);
35953594 }
35963595}
35973596
35983597void SymbolDatabase::returnImplicitIntError (const Token *tok) const
35993598{
3600- if (tok && mSettings .severity .isEnabled (Severity::portability) && (tok->isC () && mSettings .standards .c != Standards::C89) && mErrorLogger ) {
3599+ if (tok && mSettings .severity .isEnabled (Severity::portability) && (tok->isC () && mSettings .standards .c != Standards::C89)) {
36013600 const std::list<const Token*> locationList (1 , tok);
36023601 const ErrorMessage errmsg (locationList, &mTokenizer .list ,
36033602 Severity::portability,
36043603 " returnImplicitInt" ,
36053604 " Omitted return type of function '" + tok->str () + " ' defaults to int, this is not supported by ISO C99 and later standards." ,
36063605 Certainty::normal);
3607- mErrorLogger -> reportErr (errmsg);
3606+ mErrorLogger . reportErr (errmsg);
36083607 }
36093608}
36103609
0 commit comments