Skip to content

Commit 3fe62b9

Browse files
committed
Reformat verbose and stack trace printouts for response-files.
1 parent 2a30e25 commit 3fe62b9

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

lib/Driver/Job.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,10 @@ void Job::printCommandLine(raw_ostream &os, StringRef Terminator) const {
355355
os << ' ';
356356
if (hasResponseFile()) {
357357
printArguments(os, {ResponseFileArg});
358-
} else {
359-
printArguments(os, Arguments);
358+
os << " # ";
360359
}
360+
printArguments(os, Arguments);
361+
361362
os << Terminator;
362363
}
363364

test/Driver/response-file.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
// RUN: %target-build-swift -typecheck @%t.5.resp %s 2>&1 | %FileCheck %s -check-prefix=LONG
2929
// LONG: warning: result of call to 'abs' is unused
3030
// RUN: %empty-directory(%t/tmp)
31-
// RUN: env TMPDIR=%t/tmp/ %target-swiftc_driver %s @%t.5.resp -save-temps
31+
// RUN: env TMPDIR=%t/tmp/ %target-swiftc_driver %s @%t.5.resp -save-temps 2>&1
3232
// RUN: ls %t/tmp/arguments-*.resp
33+
// RUN: %target-build-swift -v @%t.5.resp %s 2>&1 | %FileCheck %s -check-prefix=VERBOSE
34+
// VERBOSE: @{{[^ ]*}}arguments-{{[0-9a-zA-Z]+}}.resp # -frontend -c -primary-file
3335
// RUN: not %target-swiftc_driver %s @%t.5.resp -Xfrontend -debug-crash-immediately 2>&1 | %FileCheck %s -check-prefix=CRASH
34-
// CRASH: @{{[^ ]*}}arguments-{{[0-9a-zA-Z]+}}.resp
36+
// CRASH: Program arguments: {{[^ ]*}}swift -frontend -c -primary-file
3537

3638
#if TEST0
3739
abs(-5)

tools/driver/driver.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ static bool shouldRunAsSubcommand(StringRef ExecName,
111111
extern int apinotes_main(ArrayRef<const char *> Args);
112112

113113
int main(int argc_, const char **argv_) {
114-
PROGRAM_START(argc_, argv_);
115-
116114
SmallVector<const char *, 256> argv;
117115
llvm::SpecificBumpPtrAllocator<char> ArgAllocator;
118116
std::error_code EC = llvm::sys::Process::GetArgumentVector(
@@ -134,6 +132,10 @@ int main(int argc_, const char **argv_) {
134132
llvm::cl::TokenizeGNUCommandLine,
135133
argv);
136134

135+
// Initialize the stack trace using the parsed argument vector with expanded
136+
// response files.
137+
PROGRAM_START(argv.size(), argv.data());
138+
137139
// Check if this invocation should execute a subcommand.
138140
StringRef ExecName = llvm::sys::path::stem(argv[0]);
139141
SmallString<256> SubcommandName;

0 commit comments

Comments
 (0)