Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions gui/checkthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <list>
#include <set>
#include <string>
#include <utility>
#include <vector>

#include <QByteArray>
Expand Down Expand Up @@ -110,11 +111,11 @@ CheckThread::CheckThread(ThreadResult &result) :
mResult(result)
{}

void CheckThread::setSettings(const Settings &settings, Suppressions& supprs)
void CheckThread::setSettings(const Settings &settings, std::shared_ptr<Suppressions> supprs)
{
mFiles.clear();
mSettings = settings; // this is a copy
mSuppressions = &supprs;
mSuppressions = std::move(supprs);
}

void CheckThread::analyseWholeProgram(const QStringList &files, const std::string& ctuInfo)
Expand Down
5 changes: 3 additions & 2 deletions gui/checkthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <atomic>
#include <cstdint>
#include <memory>
#include <string>
#include <vector>

Expand Down Expand Up @@ -55,7 +56,7 @@ class CheckThread : public QThread {
* @param settings settings for cppcheck
* @param supprs suppressions for cppcheck
*/
void setSettings(const Settings &settings, Suppressions& supprs);
void setSettings(const Settings &settings, std::shared_ptr<Suppressions> supprs);

/**
* @brief Run whole program analysis
Expand Down Expand Up @@ -132,7 +133,7 @@ class CheckThread : public QThread {
ThreadResult &mResult;

Settings mSettings;
Suppressions* mSuppressions{};
std::shared_ptr<Suppressions> mSuppressions;

private:
void runAddonsAndTools(const Settings& settings, const FileSettings *fileSettings, const QString &fileName);
Expand Down
17 changes: 9 additions & 8 deletions gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include <algorithm>
#include <iterator>
#include <list>
#include <memory>
#include <set>
#include <string>
#include <unordered_set>
Expand Down Expand Up @@ -542,8 +543,8 @@ void MainWindow::saveSettings() const
void MainWindow::doAnalyzeProject(ImportProject p, const bool checkLibrary, const bool checkConfiguration)
{
Settings checkSettings;
Suppressions supprs;
if (!getCppcheckSettings(checkSettings, supprs))
auto supprs = std::make_shared<Suppressions>();
if (!getCppcheckSettings(checkSettings, *supprs))
return;

clearResults();
Expand Down Expand Up @@ -613,8 +614,8 @@ void MainWindow::doAnalyzeFiles(const QStringList &files, const bool checkLibrar
return;

Settings checkSettings;
Suppressions supprs;
if (!getCppcheckSettings(checkSettings, supprs))
auto supprs = std::make_shared<Suppressions>();
if (!getCppcheckSettings(checkSettings, *supprs))
return;

clearResults();
Expand Down Expand Up @@ -1348,8 +1349,8 @@ void MainWindow::reAnalyzeSelected(const QStringList& files)
}

Settings checkSettings;
Suppressions supprs;
if (!getCppcheckSettings(checkSettings, supprs))
auto supprs = std::make_shared<Suppressions>();
if (!getCppcheckSettings(checkSettings, *supprs))
return;

// Clear details, statistics and progress
Expand Down Expand Up @@ -1383,8 +1384,8 @@ void MainWindow::reAnalyze(bool all)
return;

Settings checkSettings;
Suppressions supprs;
if (!getCppcheckSettings(checkSettings, supprs))
auto supprs = std::make_shared<Suppressions>();
if (!getCppcheckSettings(checkSettings, *supprs))
return;

// Clear details, statistics and progress
Expand Down
2 changes: 1 addition & 1 deletion gui/threadhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void ThreadHandler::setCheckFiles(const QStringList& files)
}
}

void ThreadHandler::check(const Settings &settings, Suppressions& supprs)
void ThreadHandler::check(const Settings &settings, const std::shared_ptr<Suppressions>& supprs)
{
if (mResults.getFileCount() == 0 || mRunningThreadCount > 0 || settings.jobs == 0) {
qDebug() << "Can't start checking if there's no files to check or if check is in progress.";
Expand Down
3 changes: 2 additions & 1 deletion gui/threadhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "suppressions.h"
#include "threadresult.h"

#include <memory>
#include <set>
#include <string>

Expand Down Expand Up @@ -117,7 +118,7 @@ class ThreadHandler : public QObject {
* @param settings Settings for checking
* @param supprs Suppressions for checking
*/
void check(const Settings &settings, Suppressions& supprs);
void check(const Settings &settings, const std::shared_ptr<Suppressions>& supprs);

/**
* @brief Set files to check
Expand Down