From 196b7b0f24a7d869f138ca77217f6c594bb8c6ee Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 30 Apr 2021 17:10:00 +0200 Subject: [PATCH] ClangTools: Use Utils::CommandLine for a command line Change-Id: I489e5538fe97e7d565eed22af8d285d89b870ca3 Reviewed-by: Christian Stenger --- src/plugins/clangtools/clangtoolrunner.cpp | 11 ++++++----- src/plugins/clangtools/clangtoolrunner.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/clangtools/clangtoolrunner.cpp b/src/plugins/clangtools/clangtoolrunner.cpp index bc44f41b7a3..ed046e9fc60 100644 --- a/src/plugins/clangtools/clangtoolrunner.cpp +++ b/src/plugins/clangtools/clangtoolrunner.cpp @@ -39,6 +39,8 @@ static Q_LOGGING_CATEGORY(LOG, "qtc.clangtools.runner", QtWarningMsg) +using namespace Utils; + namespace ClangTools { namespace Internal { @@ -141,11 +143,10 @@ bool ClangToolRunner::run(const QString &fileToAnalyze, const QStringList &compi m_outputFilePath = createOutputFilePath(m_outputDirPath, fileToAnalyze); QTC_ASSERT(!m_outputFilePath.isEmpty(), return false); - const QStringList arguments = m_argsCreator(compilerOptions); - m_commandLine = Utils::QtcProcess::joinArgs(QStringList(m_executable) + arguments); + m_commandLine = {m_executable, m_argsCreator(compilerOptions)}; - qCDebug(LOG).noquote() << "Starting" << m_commandLine; - m_process->setCommand({m_executable, arguments}); + qCDebug(LOG).noquote() << "Starting" << m_commandLine.toUserOutput(); + m_process->setCommand(m_commandLine); m_process->start(); return true; } @@ -184,7 +185,7 @@ QString ClangToolRunner::commandlineAndOutput() const return tr("Command line: %1\n" "Process Error: %2\n" "Output:\n%3") - .arg(m_commandLine, + .arg(m_commandLine.toUserOutput(), QString::number(m_process->error()), Utils::SynchronousProcess::normalizeNewlines(QString::fromLocal8Bit(m_processOutput))); } diff --git a/src/plugins/clangtools/clangtoolrunner.h b/src/plugins/clangtools/clangtoolrunner.h index 84368f4f775..d42967da354 100644 --- a/src/plugins/clangtools/clangtoolrunner.h +++ b/src/plugins/clangtools/clangtoolrunner.h @@ -90,7 +90,7 @@ private: QString m_fileToAnalyze; QString m_outputFilePath; - QString m_commandLine; + Utils::CommandLine m_commandLine; }; } // namespace Internal