aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp')
-rw-r--r--plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp
index 37447c5f66..4e98a28ddd 100644
--- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp
+++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp
@@ -48,6 +48,22 @@ using namespace ProjectExplorer;
namespace ClangStaticAnalyzer {
namespace Internal {
+class DummyRunConfiguration : public RunConfiguration
+{
+ Q_OBJECT
+
+public:
+ DummyRunConfiguration(Target *parent)
+ : RunConfiguration(parent, "ClangStaticAnalyzer.DummyRunConfig")
+ {
+ setDefaultDisplayName(tr("Clang Static Analyzer"));
+ addExtraAspects();
+ }
+
+private:
+ QWidget *createConfigurationWidget() { return 0; }
+};
+
ClangStaticAnalyzerTool::ClangStaticAnalyzerTool(QObject *parent)
: QObject(parent)
, m_diagnosticModel(0)
@@ -218,7 +234,22 @@ void ClangStaticAnalyzerTool::startTool()
QTC_ASSERT(m_projectInfoBeforeBuild.isValid(), return);
m_running = true;
handleStateUpdate();
- ProjectExplorerPlugin::runProject(project, ProjectExplorer::ClangStaticAnalyzerMode);
+
+ Target * const target = project->activeTarget();
+ QTC_ASSERT(target, return);
+ DummyRunConfiguration *& rc = m_runConfigs[target];
+ if (!rc) {
+ rc = new DummyRunConfiguration(target);
+ connect(project, &Project::aboutToRemoveTarget, this,
+ [this](Target *t) { m_runConfigs.remove(t); });
+ const auto onProjectRemoved = [this](Project *p) {
+ foreach (Target * const t, p->targets())
+ m_runConfigs.remove(t);
+ };
+ connect(SessionManager::instance(), &SessionManager::aboutToRemoveProject, this,
+ onProjectRemoved, Qt::UniqueConnection);
+ }
+ ProjectExplorerPlugin::runRunConfiguration(rc, ProjectExplorer::ClangStaticAnalyzerMode);
}
CppTools::ProjectInfo ClangStaticAnalyzerTool::projectInfoBeforeBuild() const
@@ -289,3 +320,5 @@ void ClangStaticAnalyzerTool::handleStateUpdate()
} // namespace Internal
} // namespace ClangStaticAnalyzer
+
+#include "clangstaticanalyzertool.moc"