ClangTools: Use Utils::CommandLine for a command line

Change-Id: I489e5538fe97e7d565eed22af8d285d89b870ca3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-04-30 17:10:00 +02:00
parent 0f61bdc04f
commit 196b7b0f24
2 changed files with 7 additions and 6 deletions

View File

@@ -39,6 +39,8 @@
static Q_LOGGING_CATEGORY(LOG, "qtc.clangtools.runner", QtWarningMsg) static Q_LOGGING_CATEGORY(LOG, "qtc.clangtools.runner", QtWarningMsg)
using namespace Utils;
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
@@ -141,11 +143,10 @@ bool ClangToolRunner::run(const QString &fileToAnalyze, const QStringList &compi
m_outputFilePath = createOutputFilePath(m_outputDirPath, fileToAnalyze); m_outputFilePath = createOutputFilePath(m_outputDirPath, fileToAnalyze);
QTC_ASSERT(!m_outputFilePath.isEmpty(), return false); QTC_ASSERT(!m_outputFilePath.isEmpty(), return false);
const QStringList arguments = m_argsCreator(compilerOptions); m_commandLine = {m_executable, m_argsCreator(compilerOptions)};
m_commandLine = Utils::QtcProcess::joinArgs(QStringList(m_executable) + arguments);
qCDebug(LOG).noquote() << "Starting" << m_commandLine; qCDebug(LOG).noquote() << "Starting" << m_commandLine.toUserOutput();
m_process->setCommand({m_executable, arguments}); m_process->setCommand(m_commandLine);
m_process->start(); m_process->start();
return true; return true;
} }
@@ -184,7 +185,7 @@ QString ClangToolRunner::commandlineAndOutput() const
return tr("Command line: %1\n" return tr("Command line: %1\n"
"Process Error: %2\n" "Process Error: %2\n"
"Output:\n%3") "Output:\n%3")
.arg(m_commandLine, .arg(m_commandLine.toUserOutput(),
QString::number(m_process->error()), QString::number(m_process->error()),
Utils::SynchronousProcess::normalizeNewlines(QString::fromLocal8Bit(m_processOutput))); Utils::SynchronousProcess::normalizeNewlines(QString::fromLocal8Bit(m_processOutput)));
} }

View File

@@ -90,7 +90,7 @@ private:
QString m_fileToAnalyze; QString m_fileToAnalyze;
QString m_outputFilePath; QString m_outputFilePath;
QString m_commandLine; Utils::CommandLine m_commandLine;
}; };
} // namespace Internal } // namespace Internal