From ef79615fe59168b176dcc18f982a0eec9346d2d1 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 16 Apr 2015 13:16:09 +0200 Subject: Extract AnalyzeUnit out of ClangStaticAnalyzerRunControl Reduces some noise in the implementation file. Change-Id: I24e81941c1888ba69f6b7f8dcab35956f60ca4e6 Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrol.cpp | 21 +++++++++------------ .../clangstaticanalyzerruncontrol.h | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 4ef7cacfa9..9eec04f25b 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -146,14 +146,13 @@ static QStringList argumentsFromProjectPart(const CppTools::ProjectPart::Ptr &pr return result; } -static QList unitsToAnalyzeFromCompilerCallData( +static AnalyzeUnits unitsToAnalyzeFromCompilerCallData( const ProjectInfo::CompilerCallData &compilerCallData, unsigned char wordWidth) { - typedef ClangStaticAnalyzerRunControl::AnalyzeUnit AnalyzeUnit; qCDebug(LOG) << "Taking arguments for analyzing from CompilerCallData."; - QList unitsToAnalyze; + AnalyzeUnits unitsToAnalyze; QHashIterator > it(compilerCallData); while (it.hasNext()) { @@ -169,15 +168,13 @@ static QList unitsToAnalyzeFromCompi return unitsToAnalyze; } -static QList unitsToAnalyzeFromProjectParts( - const QList projectParts, - const QString &toolchainType, - unsigned char wordWidth) +static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QList projectParts, + const QString &toolchainType, + unsigned char wordWidth) { - typedef ClangStaticAnalyzerRunControl::AnalyzeUnit AnalyzeUnit; qCDebug(LOG) << "Taking arguments for analyzing from ProjectParts."; - QList unitsToAnalyze; + AnalyzeUnits unitsToAnalyze; foreach (const ProjectPart::Ptr &projectPart, projectParts) { if (!projectPart->selectedForBuilding) @@ -200,9 +197,9 @@ static QList unitsToAnalyzeFromProje return unitsToAnalyze; } -QList ClangStaticAnalyzerRunControl::unitsToAnalyze() +AnalyzeUnits ClangStaticAnalyzerRunControl::unitsToAnalyze() { - QTC_ASSERT(m_projectInfo.isValid(), return QList()); + QTC_ASSERT(m_projectInfo.isValid(), return AnalyzeUnits()); const ProjectInfo::CompilerCallData compilerCallData = m_projectInfo.compilerCallData(); if (!compilerCallData.isEmpty()) @@ -249,7 +246,7 @@ bool ClangStaticAnalyzerRunControl::startEngine() m_clangLogFileDir = temporaryDir.path(); // Collect files - QList unitsToProcess = unitsToAnalyze(); + AnalyzeUnits unitsToProcess = unitsToAnalyze(); Utils::sort(unitsToProcess, [](const AnalyzeUnit &a1, const AnalyzeUnit &a2) -> bool { return a1.file < a2.file; }); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index 1da8598ffb..167539b2a9 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -31,19 +31,19 @@ namespace Internal { class ClangStaticAnalyzerRunner; class Diagnostic; +struct AnalyzeUnit { + AnalyzeUnit(const QString &file, const QStringList &options) + : file(file), arguments(options) {} + + QString file; + QStringList arguments; // without file itself and "-o somePath" +}; +typedef QList AnalyzeUnits; + class ClangStaticAnalyzerRunControl : public Analyzer::AnalyzerRunControl { Q_OBJECT -public: - struct AnalyzeUnit { - AnalyzeUnit(const QString &file, const QStringList &options) - : file(file), arguments(options) {} - - QString file; - QStringList arguments; // without file itself and "-o somePath" - }; - public: explicit ClangStaticAnalyzerRunControl(const Analyzer::AnalyzerStartParameters &startParams, ProjectExplorer::RunConfiguration *runConfiguration, @@ -56,7 +56,7 @@ signals: void newDiagnosticsAvailable(const QList &diagnostics); private: - QList unitsToAnalyze(); + AnalyzeUnits unitsToAnalyze(); void analyzeNextFile(); ClangStaticAnalyzerRunner *createRunner(); @@ -75,7 +75,7 @@ private: QString m_clangExecutable; QString m_clangLogFileDir; QFutureInterface m_progress; - QList m_unitsToProcess; + AnalyzeUnits m_unitsToProcess; QSet m_runners; int m_initialFilesToProcessSize; int m_filesAnalyzed; -- cgit v1.2.1