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) {
|
if (!mFiles.isEmpty() || mAnalyseWholeProgram) {
|
||||||
mAnalyseWholeProgram = false;
|
mAnalyseWholeProgram = false;
|
||||||
qDebug() << "Whole program analysis";
|
qDebug() << "Whole program analysis";
|
||||||
const std::string &buildDir = mCppcheck.settings().buildDir;
|
std::map<std::string,std::size_t> files2;
|
||||||
if (!buildDir.empty()) {
|
for (const QString& file : mFiles)
|
||||||
std::map<std::string,std::size_t> files2;
|
files2[file.toStdString()] = 0;
|
||||||
for (const QString& file : mFiles)
|
mCppcheck.analyseWholeProgram(mCppcheck.settings().buildDir, files2);
|
||||||
files2[file.toStdString()] = 0;
|
|
||||||
mCppcheck.analyseWholeProgram(buildDir, files2);
|
|
||||||
}
|
|
||||||
mFiles.clear();
|
mFiles.clear();
|
||||||
emit done();
|
emit done();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1759,8 +1759,10 @@ bool CppCheck::analyseWholeProgram()
|
||||||
void CppCheck::analyseWholeProgram(const std::string &buildDir, const std::map<std::string, std::size_t> &files)
|
void CppCheck::analyseWholeProgram(const std::string &buildDir, const std::map<std::string, std::size_t> &files)
|
||||||
{
|
{
|
||||||
executeAddonsWholeProgram(files);
|
executeAddonsWholeProgram(files);
|
||||||
if (buildDir.empty())
|
if (buildDir.empty()) {
|
||||||
|
removeCtuInfoFiles(files);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (mSettings.checks.isEnabled(Checks::unusedFunction))
|
if (mSettings.checks.isEnabled(Checks::unusedFunction))
|
||||||
CheckUnusedFunctions::analyseWholeProgram(this, buildDir);
|
CheckUnusedFunctions::analyseWholeProgram(this, buildDir);
|
||||||
std::list<Check::FileInfo*> fileInfoList;
|
std::list<Check::FileInfo*> fileInfoList;
|
||||||
|
@ -1821,3 +1823,14 @@ bool CppCheck::isUnusedFunctionCheckEnabled() const
|
||||||
{
|
{
|
||||||
return (mSettings.jobs == 1 && mSettings.checks.isEnabled(Checks::unusedFunction));
|
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 */
|
* and if it's possible at all */
|
||||||
bool isUnusedFunctionCheckEnabled() const;
|
bool isUnusedFunctionCheckEnabled() const;
|
||||||
|
|
||||||
|
/** Remove *.ctu-info files */
|
||||||
|
void removeCtuInfoFiles(const std::map<std::string, std::size_t>& files);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Are there "simple" rules */
|
/** Are there "simple" rules */
|
||||||
bool hasRule(const std::string &tokenlist) const;
|
bool hasRule(const std::string &tokenlist) const;
|
||||||
|
|
Loading…
Reference in New Issue