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

Method check_internal

cli/cppcheckexecutor.cpp:421–500  ·  view source on GitHub ↗

* That is a method which gets called from check_wrapper * */

Source from the content-addressed store, hash-verified

419 * That is a method which gets called from check_wrapper
420 * */
421int CppCheckExecutor::check_internal(const Settings& settings, Suppressions& supprs) const
422{
423 StdLogger stdLogger(settings);
424 std::unique_ptr<TimerResults> timerResults;
425 if (settings.showtime != Settings::ShowTime::NONE)
426 timerResults.reset(new TimerResults);
427
428 if (settings.reportProgress >= 0)
429 stdLogger.resetLatestProgressOutputTime();
430
431 if (settings.outputFormat == Settings::OutputFormat::xml) {
432 stdLogger.reportErr(ErrorMessage::getXMLHeader(settings.cppcheckCfgProductName, settings.xml_version));
433 }
434
435 if (!settings.buildDir.empty()) {
436 std::list<std::string> fileNames;
437 for (auto i = mFiles.cbegin(); i != mFiles.cend(); ++i)
438 fileNames.emplace_back(i->path());
439 AnalyzerInformation::writeFilesTxt(settings.buildDir, fileNames, mFileSettings);
440
441 stdLogger.readActiveCheckers();
442 }
443
444 if (!settings.checkersReportFilename.empty())
445 std::remove(settings.checkersReportFilename.c_str());
446
447 CppCheck cppcheck(settings, supprs, stdLogger, timerResults.get(), true, executeCommand);
448
449 unsigned int returnValue = 0;
450 if (settings.useSingleJob()) {
451 // Single process
452 SingleExecutor executor(cppcheck, mFiles, mFileSettings, settings, supprs, stdLogger, timerResults.get());
453 returnValue = executor.check();
454 } else {
455#if defined(HAS_THREADING_MODEL_THREAD)
456 if (settings.executor == Settings::ExecutorType::Thread) {
457 ThreadExecutor executor(mFiles, mFileSettings, settings, supprs, stdLogger, timerResults.get(), CppCheckExecutor::executeCommand);
458 returnValue = executor.check();
459 }
460#endif
461#if defined(HAS_THREADING_MODEL_FORK)
462 if (settings.executor == Settings::ExecutorType::Process) {
463 ProcessExecutor executor(mFiles, mFileSettings, settings, supprs, stdLogger, timerResults.get(), CppCheckExecutor::executeCommand);
464 returnValue = executor.check();
465 }
466#endif
467 }
468
469 // TODO: show time *after* the whole program analysis
470 if (timerResults) {
471 if (settings.showtime == Settings::ShowTime::SUMMARY)
472 timerResults->showResults();
473 else if (settings.showtime == Settings::ShowTime::TOP5_SUMMARY)
474 timerResults->showResults(5);
475 }
476
477 // TODO: is this run again instead of using previously cached results?
478 returnValue |= cppcheck.analyseWholeProgram(settings.buildDir, mFiles, mFileSettings, stdLogger.getCtuInfo());

Callers

nothing calls this directly

Calls 14

readActiveCheckersMethod · 0.80
getSuppressionsMethod · 0.80
writeCheckersReportMethod · 0.80
reportMetricsMethod · 0.80
hasCriticalErrorsMethod · 0.80
resetMethod · 0.45
reportErrMethod · 0.45
emptyMethod · 0.45
getMethod · 0.45
checkMethod · 0.45
showResultsMethod · 0.45

Tested by

no test coverage detected