Skip to content

[master-next] Fix up the driver's use of PROGRAM_START after PR #16362 #17494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tools/driver/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static int run_driver(StringRef ExecName,
}

int main(int argc_, const char **argv_) {
SmallVector<const char *, 256> argv(&argv_[0], &argv_[argc_]);
SmallVector<const char *, 256> args(&argv_[0], &argv_[argc_]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give this a more descriptive name, then? It's not good to have args and argv both floating around in this function.


// Expand any response files in the command line argument vector - arguments
// may be passed through response files in the event of command line length
Expand All @@ -192,11 +192,15 @@ int main(int argc_, const char **argv_) {
llvm::Triple(llvm::sys::getProcessTriple()).isOSWindows() ?
llvm::cl::TokenizeWindowsCommandLine :
llvm::cl::TokenizeGNUCommandLine,
argv);
args);

// Initialize the stack trace using the parsed argument vector with expanded
// response files.
PROGRAM_START(argv.size(), argv.data());
int ExpandedArgc = args.size();
const char **ExpandedArgv = args.data();
PROGRAM_START(ExpandedArgc, ExpandedArgv);
SmallVector<const char *, 256> argv(&ExpandedArgv[0],
&ExpandedArgv[ExpandedArgc]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is specifically no need for this SmallVector. An ArrayRef would be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. Yeah, of course. #17728


// Check if this invocation should execute a subcommand.
StringRef ExecName = llvm::sys::path::stem(argv[0]);
Expand Down