aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp35
-rw-r--r--plugins/clangstaticanalyzer/clangstaticanalyzertool.h5
2 files changed, 39 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"
diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h
index 2f9b18efa7..4334884c7e 100644
--- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h
+++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h
@@ -22,7 +22,10 @@
#include <analyzerbase/ianalyzertool.h>
#include <cpptools/cppprojects.h>
+#include <QHash>
+
namespace Analyzer { class DetailedErrorView; }
+namespace ProjectExplorer { class Target; }
namespace ClangStaticAnalyzer {
namespace Internal {
@@ -31,6 +34,7 @@ class ClangStaticAnalyzerDiagnosticFilterModel;
class ClangStaticAnalyzerDiagnosticModel;
class ClangStaticAnalyzerDiagnosticView;
class Diagnostic;
+class DummyRunConfiguration;
const char ClangStaticAnalyzerToolId[] = "ClangStaticAnalyzer";
@@ -72,6 +76,7 @@ private:
QAction *m_goBack;
QAction *m_goNext;
+ QHash<ProjectExplorer::Target *, DummyRunConfiguration *> m_runConfigs;
bool m_running;
};