BareMetal: Some adaptations to new Utils::CommandLine

Change-Id: I79f7d61037e4ed6c7aefaf10adb33308ce98fbd5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2019-06-05 13:53:51 +02:00
parent 5942b82490
commit 76fc2e0b26
3 changed files with 26 additions and 32 deletions

View File

@@ -85,17 +85,17 @@ static Macros dumpPredefinedMacros(const FilePath &compiler, const Core::Id lang
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setTimeoutS(10); cpp.setTimeoutS(10);
QStringList arguments; CommandLine cmd(compiler, {});
arguments.push_back(fakeIn.fileName()); cmd.addArg(fakeIn.fileName());
if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID) if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID)
arguments.push_back("--ec++"); cmd.addArg("--ec++");
arguments.push_back("--predef_macros"); cmd.addArg("--predef_macros");
arguments.push_back(outpath); cmd.addArg(outpath);
const SynchronousProcessResponse response = cpp.runBlocking(compiler.toString(), arguments); const SynchronousProcessResponse response = cpp.runBlocking(cmd);
if (response.result != SynchronousProcessResponse::Finished if (response.result != SynchronousProcessResponse::Finished
|| response.exitCode != 0) { || response.exitCode != 0) {
qWarning() << response.exitMessage(compiler.toString(), 10); qWarning() << response.exitMessage(cmd.toUserOutput(), 10);
return {}; return {};
} }
@@ -131,16 +131,15 @@ static HeaderPaths dumpHeaderPaths(const FilePath &compiler, const Core::Id lang
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setTimeoutS(10); cpp.setTimeoutS(10);
QStringList arguments; CommandLine cmd(compiler, {});
arguments.push_back(fakeIn.fileName()); cmd.addArg(fakeIn.fileName());
if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID) if (languageId == ProjectExplorer::Constants::CXX_LANGUAGE_ID)
arguments.push_back("--ec++"); cmd.addArg("--ec++");
arguments.push_back("--preinclude"); cmd.addArg("--preinclude");
arguments.push_back("."); cmd.addArg(".");
// Note: Response should retutn an error, just don't check on errors. // Note: Response should retutn an error, just don't check on errors.
const SynchronousProcessResponse response = cpp.runBlocking(compiler.toString(), const SynchronousProcessResponse response = cpp.runBlocking(cmd);
arguments);
HeaderPaths headerPaths; HeaderPaths headerPaths;

View File

@@ -102,13 +102,13 @@ static Macros dumpC51PredefinedMacros(const FilePath &compiler, const QStringLis
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setTimeoutS(10); cpp.setTimeoutS(10);
QStringList arguments; CommandLine cmd(compiler, {});
arguments.push_back(fakeIn.fileName()); cmd.addArg(fakeIn.fileName());
const SynchronousProcessResponse response = cpp.runBlocking(compiler.toString(), arguments); const SynchronousProcessResponse response = cpp.runBlocking(cmd);
if (response.result != SynchronousProcessResponse::Finished if (response.result != SynchronousProcessResponse::Finished
|| response.exitCode != 0) { || response.exitCode != 0) {
qWarning() << response.exitMessage(compiler.toString(), 10); qWarning() << response.exitMessage(cmd.toUserOutput(), 10);
return {}; return {};
} }
@@ -131,11 +131,10 @@ static Macros dumpArmPredefinedMacros(const FilePath &compiler, const QStringLis
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setTimeoutS(10); cpp.setTimeoutS(10);
QStringList arguments; CommandLine cmd(compiler, {});
arguments.push_back("-E"); cmd.addArgs({"-E", "--list-macros"});
arguments.push_back("--list-macros");
const SynchronousProcessResponse response = cpp.runBlocking(compiler.toString(), arguments); const SynchronousProcessResponse response = cpp.runBlocking(cmd);
if (response.result != SynchronousProcessResponse::Finished if (response.result != SynchronousProcessResponse::Finished
|| response.exitCode != 0) { || response.exitCode != 0) {
qWarning() << response.exitMessage(compiler.toString(), 10); qWarning() << response.exitMessage(compiler.toString(), 10);

View File

@@ -92,13 +92,10 @@ static Macros dumpPredefinedMacros(const FilePath &compiler, const QStringList &
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setTimeoutS(10); cpp.setTimeoutS(10);
QStringList arguments; CommandLine cmd(compiler, {});
arguments.push_back(compilerTargetFlag(abi)); cmd.addArgs({compilerTargetFlag(abi), "-dM", "-E", fakeIn.fileName()});
arguments.push_back("-dM");
arguments.push_back("-E");
arguments.push_back(fakeIn.fileName());
const SynchronousProcessResponse response = cpp.runBlocking(compiler.toString(), arguments); const SynchronousProcessResponse response = cpp.runBlocking(cmd);
if (response.result != SynchronousProcessResponse::Finished if (response.result != SynchronousProcessResponse::Finished
|| response.exitCode != 0) { || response.exitCode != 0) {
qWarning() << response.exitMessage(compiler.toString(), 10); qWarning() << response.exitMessage(compiler.toString(), 10);
@@ -119,11 +116,10 @@ static HeaderPaths dumpHeaderPaths(const FilePath &compiler, const QStringList &
cpp.setEnvironment(env); cpp.setEnvironment(env);
cpp.setTimeoutS(10); cpp.setTimeoutS(10);
QStringList arguments; CommandLine cmd(compiler, {});
arguments.push_back(compilerTargetFlag(abi)); cmd.addArgs({compilerTargetFlag(abi), "--print-search-dirs"});
arguments.push_back("--print-search-dirs");
const SynchronousProcessResponse response = cpp.runBlocking(compiler.toString(), arguments); const SynchronousProcessResponse response = cpp.runBlocking(cmd);
if (response.result != SynchronousProcessResponse::Finished if (response.result != SynchronousProcessResponse::Finished
|| response.exitCode != 0) { || response.exitCode != 0) {
qWarning() << response.exitMessage(compiler.toString(), 10); qWarning() << response.exitMessage(compiler.toString(), 10);