From 3fe62b94e7bf0f04b1a37bf6b64abd43fcdf415f Mon Sep 17 00:00:00 2001 From: Austin Belknap Date: Wed, 23 May 2018 11:05:20 -0700 Subject: [PATCH] Reformat verbose and stack trace printouts for response-files. --- lib/Driver/Job.cpp | 5 +++-- test/Driver/response-file.swift | 6 ++++-- tools/driver/driver.cpp | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/Driver/Job.cpp b/lib/Driver/Job.cpp index 625d3218bab..85a7e88e09d 100644 --- a/lib/Driver/Job.cpp +++ b/lib/Driver/Job.cpp @@ -355,9 +355,10 @@ void Job::printCommandLine(raw_ostream &os, StringRef Terminator) const { os << ' '; if (hasResponseFile()) { printArguments(os, {ResponseFileArg}); - } else { - printArguments(os, Arguments); + os << " # "; } + printArguments(os, Arguments); + os << Terminator; } diff --git a/test/Driver/response-file.swift b/test/Driver/response-file.swift index 46c46a1f2ba..8b0c5ff9f1c 100644 --- a/test/Driver/response-file.swift +++ b/test/Driver/response-file.swift @@ -28,10 +28,12 @@ // RUN: %target-build-swift -typecheck @%t.5.resp %s 2>&1 | %FileCheck %s -check-prefix=LONG // LONG: warning: result of call to 'abs' is unused // RUN: %empty-directory(%t/tmp) -// RUN: env TMPDIR=%t/tmp/ %target-swiftc_driver %s @%t.5.resp -save-temps +// RUN: env TMPDIR=%t/tmp/ %target-swiftc_driver %s @%t.5.resp -save-temps 2>&1 // RUN: ls %t/tmp/arguments-*.resp +// RUN: %target-build-swift -v @%t.5.resp %s 2>&1 | %FileCheck %s -check-prefix=VERBOSE +// VERBOSE: @{{[^ ]*}}arguments-{{[0-9a-zA-Z]+}}.resp # -frontend -c -primary-file // RUN: not %target-swiftc_driver %s @%t.5.resp -Xfrontend -debug-crash-immediately 2>&1 | %FileCheck %s -check-prefix=CRASH -// CRASH: @{{[^ ]*}}arguments-{{[0-9a-zA-Z]+}}.resp +// CRASH: Program arguments: {{[^ ]*}}swift -frontend -c -primary-file #if TEST0 abs(-5) diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp index a9854576f5c..9bc01affd6c 100644 --- a/tools/driver/driver.cpp +++ b/tools/driver/driver.cpp @@ -111,8 +111,6 @@ static bool shouldRunAsSubcommand(StringRef ExecName, extern int apinotes_main(ArrayRef Args); int main(int argc_, const char **argv_) { - PROGRAM_START(argc_, argv_); - SmallVector argv; llvm::SpecificBumpPtrAllocator ArgAllocator; std::error_code EC = llvm::sys::Process::GetArgumentVector( @@ -134,6 +132,10 @@ int main(int argc_, const char **argv_) { llvm::cl::TokenizeGNUCommandLine, argv); + // Initialize the stack trace using the parsed argument vector with expanded + // response files. + PROGRAM_START(argv.size(), argv.data()); + // Check if this invocation should execute a subcommand. StringRef ExecName = llvm::sys::path::stem(argv[0]); SmallString<256> SubcommandName;