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

View File

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

View File

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