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

Method run

gui/checkthread.cpp:128–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128void CheckThread::run()
129{
130 mState = Running;
131
132 CppCheck cppcheck(mSettings, *mSuppressions, mResult, nullptr, true, executeCommand);
133
134 if (!mFiles.empty() || mAnalyseWholeProgram) {
135 mAnalyseWholeProgram = false;
136 std::string ctuInfo;
137 ctuInfo.swap(mCtuInfo);
138 qDebug() << "Whole program analysis";
139 cppcheck.analyseWholeProgram(mSettings.buildDir, mFiles, {}, ctuInfo);
140 mFiles.clear();
141 emit done();
142 return;
143 }
144
145 // TODO: apply enforcedLanguage
146 const FileWithDetails* file = nullptr;
147 mResult.getNextFile(file);
148 while (file && mState == Running) {
149 const std::string& fname = file->spath();
150 qDebug() << "Checking file" << QString::fromStdString(fname);
151
152 const Details details{ mThreadIndex, QString::fromStdString(fname), QTime::currentTime(), };
153 emit startCheck(details);
154
155 cppcheck.check(*file);
156 runAddonsAndTools(mSettings, nullptr, QString::fromStdString(fname));
157
158 emit finishCheck(details);
159
160 if (mState == Running)
161 mResult.getNextFile(file);
162 }
163
164 const FileSettings* fileSettings = nullptr;
165 mResult.getNextFileSettings(fileSettings);
166 while (fileSettings && mState == Running) {
167 const std::string& fname = fileSettings->filename();
168 qDebug() << "Checking file" << QString::fromStdString(fname);
169
170 const Details details{ mThreadIndex, QString::fromStdString(fname), QTime::currentTime(), };
171 emit startCheck(details);
172
173 cppcheck.check(*fileSettings);
174 runAddonsAndTools(mSettings, fileSettings, QString::fromStdString(fname));
175
176 emit finishCheck(details);
177
178
179 if (mState == Running)
180 mResult.getNextFileSettings(fileSettings);
181 }
182
183 if (mState == Running)
184 mState = Ready;
185 else

Callers

nothing calls this directly

Calls 7

getNextFileMethod · 0.80
getNextFileSettingsMethod · 0.80
emptyMethod · 0.45
swapMethod · 0.45
analyseWholeProgramMethod · 0.45
clearMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected