Cppcheck
|
Thread to run cppcheck. More...
#include <checkthread.h>
Signals | |
void | done () |
cpp checking is done More... | |
void | fileChecked (const QString &file) |
Public Member Functions | |
CheckThread (ThreadResult &result) | |
void | check (const Settings &settings) |
Set settings for cppcheck. More... | |
void | analyseWholeProgram (const QStringList &files) |
Run whole program analysis. More... | |
void | setAddonsAndTools (const QStringList &addonsAndTools) |
void | setClangIncludePaths (const QStringList &s) |
void | setSuppressions (const QList< SuppressionList::Suppression > &s) |
void | run () override |
method that is run in a thread More... | |
void | stop () |
Static Public Member Functions | |
static QString | clangCmd () |
Determine command to run clang. More... | |
static QString | clangTidyCmd () |
Determine command to run clang-tidy. More... | |
static int | executeCommand (std::string exe, std::vector< std::string > args, std::string redirect, std::string &output) |
Protected Types | |
enum | State { Running , Stopping , Stopped , Ready } |
States for the check thread. More... | |
Protected Attributes | |
std::atomic< State > | mState {Ready} |
Thread's current execution state. More... | |
ThreadResult & | mResult |
CppCheck | mCppcheck |
Cppcheck itself. More... | |
Private Member Functions | |
void | runAddonsAndTools (const FileSettings *fileSettings, const QString &fileName) |
void | parseClangErrors (const QString &tool, const QString &file0, QString err) |
bool | isSuppressed (const SuppressionList::ErrorMessage &errorMessage) const |
Private Attributes | |
QStringList | mFiles |
bool | mAnalyseWholeProgram {} |
QStringList | mAddonsAndTools |
QStringList | mClangIncludePaths |
QList< SuppressionList::Suppression > | mSuppressions |
Thread to run cppcheck.
Definition at line 47 of file checkthread.h.
|
protected |
States for the check thread.
Whole purpose of these states is to allow stopping of the checking. When stopping we say for the thread (Stopping) that stop when current check has been completed. Thread must be stopped cleanly, just terminating thread likely causes unpredictable side-effects.
Enumerator | |
---|---|
Running | The thread is checking. |
Stopping | The thread will stop after current work. |
Stopped | The thread has been stopped. |
Ready | The thread is ready. |
Definition at line 118 of file checkthread.h.
|
explicit |
Definition at line 87 of file checkthread.cpp.
void CheckThread::analyseWholeProgram | ( | const QStringList & | files | ) |
Run whole program analysis.
files | All files |
Definition at line 99 of file checkthread.cpp.
References mAnalyseWholeProgram, and mFiles.
void CheckThread::check | ( | const Settings & | settings | ) |
Set settings for cppcheck.
settings | settings for cppcheck |
Definition at line 92 of file checkthread.cpp.
References mCppcheck, mFiles, and CppCheck::settings().
|
static |
Determine command to run clang.
Definition at line 420 of file checkthread.cpp.
References SETTINGS_CLANG_PATH.
Referenced by runAddonsAndTools().
|
static |
Determine command to run clang-tidy.
Definition at line 445 of file checkthread.cpp.
References SETTINGS_CLANG_PATH.
Referenced by ProjectFileDialog::loadFromProjectFile(), and runAddonsAndTools().
|
signal |
cpp checking is done
Referenced by ThreadHandler::removeThreads(), run(), and ThreadHandler::setThreadCount().
|
static |
Definition at line 60 of file checkthread.cpp.
References startsWith().
Referenced by MainWindow::getCppcheckSettings().
|
signal |
Referenced by ThreadHandler::removeThreads(), and ThreadHandler::setThreadCount().
|
private |
Definition at line 413 of file checkthread.cpp.
References mSuppressions.
Referenced by parseClangErrors().
|
private |
Definition at line 314 of file checkthread.cpp.
References CLANG_ANALYZER, CLANG_TIDY, error, ErrorItem::errorId, SuppressionList::ErrorMessage::errorId, ErrorItem::errorPath, ErrorItem::file0, information, isSuppressed(), SuppressionList::ErrorMessage::lineNumber, ErrorItem::message, mResult, normal, performance, portability, ThreadResult::reportErr(), SuppressionList::ErrorMessage::setFileName(), ErrorItem::severity, style, SuppressionList::ErrorMessage::symbolNames, and warning.
Referenced by runAddonsAndTools().
|
override |
method that is run in a thread
Definition at line 107 of file checkthread.cpp.
References CppCheck::analyseWholeProgram(), Settings::buildDir, done(), mAnalyseWholeProgram, mCppcheck, mFiles, mState, Running, and CppCheck::settings().
|
private |
Definition at line 155 of file checkthread.cpp.
References Settings::buildDir, FileSettings::cfg, CLANG_ANALYZER, CLANG_TIDY, clangCmd(), clangTidyCmd(), debug, FileSettings::defines, FileSettings::filename(), AnalyzerInformation::getAnalyzerInfoFile(), Standards::getCPP(), FileSettings::includePaths, mAddonsAndTools, mClangIncludePaths, mCppcheck, parseClangErrors(), CppCheck::settings(), FileSettings::standard, Settings::standards, startsWith(), FileSettings::systemIncludePaths, and FileSettings::undefs.
|
inline |
Definition at line 65 of file checkthread.h.
References mAddonsAndTools.
|
inline |
Definition at line 69 of file checkthread.h.
References mClangIncludePaths.
|
inline |
Definition at line 73 of file checkthread.h.
References mSuppressions.
void CheckThread::stop | ( | ) |
Definition at line 308 of file checkthread.cpp.
References mState, Stopping, and Settings::terminate().
|
private |
Definition at line 145 of file checkthread.h.
Referenced by runAddonsAndTools(), and setAddonsAndTools().
|
private |
Definition at line 144 of file checkthread.h.
Referenced by analyseWholeProgram(), and run().
|
private |
Definition at line 146 of file checkthread.h.
Referenced by runAddonsAndTools(), and setClangIncludePaths().
|
protected |
Cppcheck itself.
Definition at line 134 of file checkthread.h.
Referenced by check(), run(), and runAddonsAndTools().
|
private |
Definition at line 143 of file checkthread.h.
Referenced by analyseWholeProgram(), check(), and run().
|
protected |
Definition at line 130 of file checkthread.h.
Referenced by parseClangErrors().
Thread's current execution state.
Can be changed from outside
Definition at line 128 of file checkthread.h.
|
private |
Definition at line 147 of file checkthread.h.
Referenced by isSuppressed(), and setSuppressions().