GUI: update whole program analysis

This commit is contained in:
Daniel Marjamäki 2016-12-09 20:48:32 +01:00
parent ea905c9a36
commit 6f2480fb4d
3 changed files with 15 additions and 13 deletions

View File

@ -25,7 +25,8 @@
CheckThread::CheckThread(ThreadResult &result) :
mState(Ready),
mResult(result),
mCppcheck(result, true)
mCppcheck(result, true),
mAnalyseWholeProgram(false)
{
//ctor
}
@ -45,6 +46,7 @@ void CheckThread::Check(const Settings &settings)
void CheckThread::AnalyseWholeProgram(const QStringList &files)
{
mFiles = files;
mAnalyseWholeProgram = true;
start();
}
@ -52,7 +54,8 @@ void CheckThread::run()
{
mState = Running;
if (!mFiles.isEmpty()) {
if (!mFiles.isEmpty() || mAnalyseWholeProgram) {
mAnalyseWholeProgram = false;
qDebug() << "Whole program analysis";
const std::string &buildDir = mCppcheck.settings().buildDir;
if (!buildDir.empty()) {

View File

@ -100,6 +100,7 @@ protected:
private:
QStringList mFiles;
bool mAnalyseWholeProgram;
};
/// @}
#endif // CHECKTHREAD_H

View File

@ -388,6 +388,11 @@ void MainWindow::DoCheckProject(ImportProject p)
if (mProject)
qDebug() << "Checking project file" << mProject->GetProjectFile()->GetFilename();
if (!checkSettings.buildDir.empty()) {
std::list<std::string> sourcefiles;
AnalyzerInformation::writeFilesTxt(checkSettings.buildDir, sourcefiles, p.fileSettings);
}
//mThread->SetCheckProject(true);
mThread->SetProject(p);
mThread->Check(checkSettings, true);
@ -439,17 +444,10 @@ void MainWindow::DoCheckFiles(const QStringList &files)
qDebug() << "Checking project file" << mProject->GetProjectFile()->GetFilename();
if (!checkSettings.buildDir.empty()) {
QString s = QString::fromStdString(checkSettings.buildDir);
if (!s.endsWith('/'))
s += '/';
s += "files.txt";
std::ofstream fout(s.toStdString());
if (fout.is_open()) {
foreach (QString f, fileNames) {
fout << f.toStdString() << '\n';
}
}
std::list<std::string> sourcefiles;
foreach (QString s, fileNames)
sourcefiles.push_back(s.toStdString());
AnalyzerInformation::writeFilesTxt(checkSettings.buildDir, sourcefiles, checkSettings.project.fileSettings);
}
mThread->SetCheckFiles(true);