From 16894251278b0d575cd8b5695724e88d1026b103 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 5 Apr 2016 14:58:42 +0200 Subject: [PATCH] ClangStaticAnalyzer: Extract inputAndOutputArgumentsRemoved() Change-Id: Ie9fbec44006775779280293661eff2ff28f2618a Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrol.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 91b2d7995c2..c632dc7a08d 100644 --- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -116,12 +116,8 @@ static void prependTargetTripleIfNotIncludedAndNotEmpty(QStringList *arguments, } } -// Removes (1) filePath (2) -o . -// Prepends -m64/-m32 argument if not already included. -// Prepends -target if not already included. -static QStringList tweakedArguments(const QString &filePath, - const QStringList &arguments, - const ExtraToolChainInfo &extraParams) +// Removes (1) inputFile (2) -o . +QStringList inputAndOutputArgumentsRemoved(const QString &inputFile, const QStringList &arguments) { QStringList newArguments; @@ -133,7 +129,7 @@ static QStringList tweakedArguments(const QString &filePath, } else if (argument == QLatin1String("-o")) { skip = true; continue; - } else if (QDir::fromNativeSeparators(argument) == filePath) { + } else if (QDir::fromNativeSeparators(argument) == inputFile) { continue; // TODO: Let it in? } @@ -141,6 +137,14 @@ static QStringList tweakedArguments(const QString &filePath, } QTC_CHECK(skip == false); + return newArguments; +} + +static QStringList tweakedArguments(const QString &filePath, + const QStringList &arguments, + const ExtraToolChainInfo &extraParams) +{ + QStringList newArguments = inputAndOutputArgumentsRemoved(filePath, arguments); prependWordWidthArgumentIfNotIncluded(&newArguments, extraParams.wordWidth); prependTargetTripleIfNotIncludedAndNotEmpty(&newArguments, extraParams.targetTriple);