@@ -147,13 +147,13 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
147147#else
148148 const bool caseSensitive = true ;
149149#endif
150- if (!mSettings -> project .fileSettings .empty () && !mSettings -> fileFilters .empty ()) {
150+ if (!settings. project .fileSettings .empty () && !settings. fileFilters .empty ()) {
151151 // filter only for the selected filenames from all project files
152152 std::list<ImportProject::FileSettings> newList;
153153
154154 const std::list<ImportProject::FileSettings>& fileSettings = settings.project .fileSettings ;
155155 std::copy_if (fileSettings.cbegin (), fileSettings.cend (), std::back_inserter (newList), [&](const ImportProject::FileSettings& fs) {
156- return matchglobs (mSettings -> fileFilters , fs.filename );
156+ return matchglobs (settings. fileFilters , fs.filename );
157157 });
158158 if (!newList.empty ())
159159 settings.project .fileSettings = newList;
@@ -165,7 +165,7 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
165165 // Execute recursiveAddFiles() to each given file parameter
166166 const PathMatch matcher (ignored, caseSensitive);
167167 for (const std::string &pathname : pathnames) {
168- std::string err = FileLister::recursiveAddFiles (mFiles , Path::toNativeSeparators (pathname), mSettings -> library .markupExtensions (), matcher);
168+ std::string err = FileLister::recursiveAddFiles (mFiles , Path::toNativeSeparators (pathname), settings. library .markupExtensions (), matcher);
169169 if (!err.empty ()) {
170170 std::cout << " cppcheck: " << err << std::endl;
171171 }
@@ -177,10 +177,10 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
177177 if (!ignored.empty ())
178178 std::cout << " cppcheck: Maybe all paths were ignored?" << std::endl;
179179 return false ;
180- } else if (!mSettings -> fileFilters .empty () && settings.project .fileSettings .empty ()) {
180+ } else if (!settings. fileFilters .empty () && settings.project .fileSettings .empty ()) {
181181 std::map<std::string, std::size_t > newMap;
182182 for (std::map<std::string, std::size_t >::const_iterator i = mFiles .cbegin (); i != mFiles .cend (); ++i)
183- if (matchglobs (mSettings -> fileFilters , i->first )) {
183+ if (matchglobs (settings. fileFilters , i->first )) {
184184 newMap[i->first ] = i->second ;
185185 }
186186 mFiles = newMap;
@@ -226,11 +226,6 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
226226 return ret;
227227}
228228
229- void CppCheckExecutor::setSettings (const Settings &settings)
230- {
231- mSettings = &settings;
232- }
233-
234229int CppCheckExecutor::check_wrapper (CppCheck& cppcheck)
235230{
236231#ifdef USE_WINDOWS_SEH
@@ -266,7 +261,6 @@ bool CppCheckExecutor::reportSuppressions(const Settings &settings, bool unusedF
266261int CppCheckExecutor::check_internal (CppCheck& cppcheck)
267262{
268263 Settings& settings = cppcheck.settings ();
269- mSettings = &settings;
270264 const bool std = tryLoadLibrary (settings.library , settings.exename , " std.cfg" );
271265
272266 for (const std::string &lib : settings.libraries ) {
@@ -330,8 +324,8 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck)
330324 unsigned int c = 0 ;
331325 if (settings.project .fileSettings .empty ()) {
332326 for (std::map<std::string, std::size_t >::const_iterator i = mFiles .cbegin (); i != mFiles .cend (); ++i) {
333- if (!mSettings -> library .markupFile (i->first )
334- || !mSettings -> library .processMarkupAfterCode (i->first )) {
327+ if (!settings. library .markupFile (i->first )
328+ || !settings. library .processMarkupAfterCode (i->first )) {
335329 returnValue += cppcheck.check (i->first );
336330 processedsize += i->second ;
337331 if (!settings.quiet )
@@ -355,7 +349,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck)
355349 // second loop to parse all markup files which may not work until all
356350 // c/cpp files have been parsed and checked
357351 for (std::map<std::string, std::size_t >::const_iterator i = mFiles .cbegin (); i != mFiles .cend (); ++i) {
358- if (mSettings -> library .markupFile (i->first ) && mSettings -> library .processMarkupAfterCode (i->first )) {
352+ if (settings. library .markupFile (i->first ) && settings. library .processMarkupAfterCode (i->first )) {
359353 returnValue += cppcheck.check (i->first );
360354 processedsize += i->second ;
361355 if (!settings.quiet )
@@ -374,7 +368,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck)
374368 returnValue = executor.check ();
375369 }
376370
377- cppcheck.analyseWholeProgram (mSettings -> buildDir , mFiles );
371+ cppcheck.analyseWholeProgram (settings. buildDir , mFiles );
378372
379373 if (settings.severity .isEnabled (Severity::information) || settings.checkConfiguration ) {
380374 const bool err = reportSuppressions (settings, cppcheck.isUnusedFunctionCheckEnabled (), mFiles , *this );
@@ -413,7 +407,6 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck)
413407 reportErr (ErrorMessage::getXMLFooter ());
414408 }
415409
416- mSettings = nullptr ;
417410 if (returnValue)
418411 return settings.exitCode ;
419412 return 0 ;
0 commit comments