Cleanup *.ctu-info files that are not needed anymore after analysis
This commit is contained in:
parent
7515305581
commit
f8c4354d2e
|
@ -108,13 +108,10 @@ void CheckThread::run()
|
|||
if (!mFiles.isEmpty() || mAnalyseWholeProgram) {
|
||||
mAnalyseWholeProgram = false;
|
||||
qDebug() << "Whole program analysis";
|
||||
const std::string &buildDir = mCppcheck.settings().buildDir;
|
||||
if (!buildDir.empty()) {
|
||||
std::map<std::string,std::size_t> files2;
|
||||
for (const QString& file : mFiles)
|
||||
files2[file.toStdString()] = 0;
|
||||
mCppcheck.analyseWholeProgram(buildDir, files2);
|
||||
}
|
||||
mCppcheck.analyseWholeProgram(mCppcheck.settings().buildDir, files2);
|
||||
mFiles.clear();
|
||||
emit done();
|
||||
return;
|
||||
|
|
|
@ -1759,8 +1759,10 @@ bool CppCheck::analyseWholeProgram()
|
|||
void CppCheck::analyseWholeProgram(const std::string &buildDir, const std::map<std::string, std::size_t> &files)
|
||||
{
|
||||
executeAddonsWholeProgram(files);
|
||||
if (buildDir.empty())
|
||||
if (buildDir.empty()) {
|
||||
removeCtuInfoFiles(files);
|
||||
return;
|
||||
}
|
||||
if (mSettings.checks.isEnabled(Checks::unusedFunction))
|
||||
CheckUnusedFunctions::analyseWholeProgram(this, buildDir);
|
||||
std::list<Check::FileInfo*> fileInfoList;
|
||||
|
@ -1821,3 +1823,14 @@ bool CppCheck::isUnusedFunctionCheckEnabled() const
|
|||
{
|
||||
return (mSettings.jobs == 1 && mSettings.checks.isEnabled(Checks::unusedFunction));
|
||||
}
|
||||
|
||||
void CppCheck::removeCtuInfoFiles(const std::map<std::string, std::size_t> &files)
|
||||
{
|
||||
if (mSettings.buildDir.empty()) {
|
||||
for (const auto& f: files) {
|
||||
const std::string &dumpFileName = getDumpFileName(mSettings, f.first);
|
||||
const std::string &ctuInfoFileName = getCtuInfoFileName(dumpFileName);
|
||||
std::remove(ctuInfoFileName.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,6 +145,9 @@ public:
|
|||
* and if it's possible at all */
|
||||
bool isUnusedFunctionCheckEnabled() const;
|
||||
|
||||
/** Remove *.ctu-info files */
|
||||
void removeCtuInfoFiles(const std::map<std::string, std::size_t>& files);
|
||||
|
||||
private:
|
||||
/** Are there "simple" rules */
|
||||
bool hasRule(const std::string &tokenlist) const;
|
||||
|
|
Loading…
Reference in New Issue