GUI: update whole program analysis
This commit is contained in:
parent
ea905c9a36
commit
6f2480fb4d
|
@ -25,7 +25,8 @@
|
||||||
CheckThread::CheckThread(ThreadResult &result) :
|
CheckThread::CheckThread(ThreadResult &result) :
|
||||||
mState(Ready),
|
mState(Ready),
|
||||||
mResult(result),
|
mResult(result),
|
||||||
mCppcheck(result, true)
|
mCppcheck(result, true),
|
||||||
|
mAnalyseWholeProgram(false)
|
||||||
{
|
{
|
||||||
//ctor
|
//ctor
|
||||||
}
|
}
|
||||||
|
@ -45,6 +46,7 @@ void CheckThread::Check(const Settings &settings)
|
||||||
void CheckThread::AnalyseWholeProgram(const QStringList &files)
|
void CheckThread::AnalyseWholeProgram(const QStringList &files)
|
||||||
{
|
{
|
||||||
mFiles = files;
|
mFiles = files;
|
||||||
|
mAnalyseWholeProgram = true;
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +54,8 @@ void CheckThread::run()
|
||||||
{
|
{
|
||||||
mState = Running;
|
mState = Running;
|
||||||
|
|
||||||
if (!mFiles.isEmpty()) {
|
if (!mFiles.isEmpty() || mAnalyseWholeProgram) {
|
||||||
|
mAnalyseWholeProgram = false;
|
||||||
qDebug() << "Whole program analysis";
|
qDebug() << "Whole program analysis";
|
||||||
const std::string &buildDir = mCppcheck.settings().buildDir;
|
const std::string &buildDir = mCppcheck.settings().buildDir;
|
||||||
if (!buildDir.empty()) {
|
if (!buildDir.empty()) {
|
||||||
|
|
|
@ -100,6 +100,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList mFiles;
|
QStringList mFiles;
|
||||||
|
bool mAnalyseWholeProgram;
|
||||||
};
|
};
|
||||||
/// @}
|
/// @}
|
||||||
#endif // CHECKTHREAD_H
|
#endif // CHECKTHREAD_H
|
||||||
|
|
|
@ -388,6 +388,11 @@ void MainWindow::DoCheckProject(ImportProject p)
|
||||||
if (mProject)
|
if (mProject)
|
||||||
qDebug() << "Checking project file" << mProject->GetProjectFile()->GetFilename();
|
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->SetCheckProject(true);
|
||||||
mThread->SetProject(p);
|
mThread->SetProject(p);
|
||||||
mThread->Check(checkSettings, true);
|
mThread->Check(checkSettings, true);
|
||||||
|
@ -439,17 +444,10 @@ void MainWindow::DoCheckFiles(const QStringList &files)
|
||||||
qDebug() << "Checking project file" << mProject->GetProjectFile()->GetFilename();
|
qDebug() << "Checking project file" << mProject->GetProjectFile()->GetFilename();
|
||||||
|
|
||||||
if (!checkSettings.buildDir.empty()) {
|
if (!checkSettings.buildDir.empty()) {
|
||||||
QString s = QString::fromStdString(checkSettings.buildDir);
|
std::list<std::string> sourcefiles;
|
||||||
if (!s.endsWith('/'))
|
foreach (QString s, fileNames)
|
||||||
s += '/';
|
sourcefiles.push_back(s.toStdString());
|
||||||
s += "files.txt";
|
AnalyzerInformation::writeFilesTxt(checkSettings.buildDir, sourcefiles, checkSettings.project.fileSettings);
|
||||||
|
|
||||||
std::ofstream fout(s.toStdString());
|
|
||||||
if (fout.is_open()) {
|
|
||||||
foreach (QString f, fileNames) {
|
|
||||||
fout << f.toStdString() << '\n';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mThread->SetCheckFiles(true);
|
mThread->SetCheckFiles(true);
|
||||||
|
|
Loading…
Reference in New Issue