Reformat verbose and stack trace printouts for response-files.

This commit is contained in:
Austin Belknap
2018-05-23 11:05:20 -07:00
parent 2a30e25504
commit 3fe62b94e7
3 changed files with 11 additions and 6 deletions

View File

@@ -355,9 +355,10 @@ void Job::printCommandLine(raw_ostream &os, StringRef Terminator) const {
os << ' '; os << ' ';
if (hasResponseFile()) { if (hasResponseFile()) {
printArguments(os, {ResponseFileArg}); printArguments(os, {ResponseFileArg});
} else { os << " # ";
printArguments(os, Arguments);
} }
printArguments(os, Arguments);
os << Terminator; os << Terminator;
} }

View File

@@ -28,10 +28,12 @@
// RUN: %target-build-swift -typecheck @%t.5.resp %s 2>&1 | %FileCheck %s -check-prefix=LONG // 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 // LONG: warning: result of call to 'abs' is unused
// RUN: %empty-directory(%t/tmp) // 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: 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 // 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 #if TEST0
abs(-5) abs(-5)

View File

@@ -111,8 +111,6 @@ static bool shouldRunAsSubcommand(StringRef ExecName,
extern int apinotes_main(ArrayRef<const char *> Args); extern int apinotes_main(ArrayRef<const char *> Args);
int main(int argc_, const char **argv_) { int main(int argc_, const char **argv_) {
PROGRAM_START(argc_, argv_);
SmallVector<const char *, 256> argv; SmallVector<const char *, 256> argv;
llvm::SpecificBumpPtrAllocator<char> ArgAllocator; llvm::SpecificBumpPtrAllocator<char> ArgAllocator;
std::error_code EC = llvm::sys::Process::GetArgumentVector( std::error_code EC = llvm::sys::Process::GetArgumentVector(
@@ -134,6 +132,10 @@ int main(int argc_, const char **argv_) {
llvm::cl::TokenizeGNUCommandLine, llvm::cl::TokenizeGNUCommandLine,
argv); 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. // Check if this invocation should execute a subcommand.
StringRef ExecName = llvm::sys::path::stem(argv[0]); StringRef ExecName = llvm::sys::path::stem(argv[0]);
SmallString<256> SubcommandName; SmallString<256> SubcommandName;