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

Method needsReCheck

gui/threadhandler.cpp:283–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281}
282
283bool ThreadHandler::needsReCheck(const QString &filename, std::set<QString> &modified, std::set<QString> &unmodified) const
284{
285 if (modified.find(filename) != modified.end())
286 return true;
287
288 if (unmodified.find(filename) != unmodified.end())
289 return false;
290
291 if (QFileInfo(filename).lastModified() > mLastCheckTime) {
292 return true;
293 }
294
295 // Parse included files recursively
296 QFile f(filename);
297 if (!f.open(QIODevice::ReadOnly | QIODevice::Text))
298 return false;
299
300 // prevent recursion..
301 unmodified.insert(filename);
302
303 QTextStream in(&f);
304 while (!in.atEnd()) {
305 QString line = in.readLine();
306 if (line.startsWith("#include \"")) {
307 line.remove(0,10);
308 const int i = line.indexOf("\"");
309 if (i > 0) {
310 line.remove(i,line.length());
311 line = QFileInfo(filename).absolutePath() + "/" + line;
312 if (needsReCheck(line, modified, unmodified)) {
313 modified.insert(std::move(line));
314 return true;
315 }
316 }
317 }
318 }
319
320 return false;
321}
322
323QDateTime ThreadHandler::getCheckStartTime() const
324{

Callers

nothing calls this directly

Calls 4

startsWithMethod · 0.80
findMethod · 0.45
endMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected