[PATCH] D45641: Rename sys::Process::GetArgumentVector -> sys::windows::GetCommandLineArguments

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 16 10:33:42 PDT 2018


zturner added a comment.

So I think one option here that maybe solves both problems at once is to create two functions in `sys::Process`.

One called `sys::Process::SaveCommandLineArguments` and another called `sys::Process::GetSavedCommandLineArguments`.

In the second one, you assert if the first one has not been called.

Then, call the first one from `InitLLVM::InitLLVM` constructor.  Have the second one **not** require the argument vector to be passed in, instead save it in a global in `sys::Process` or something.

This way, anyone using `InitLLVM` (which should be everyone) has to do nothing, and all command line arguments are available from anywhere in the program, without needing to pass in the args from main.  This way it is not Windows specific, and provides value everywhere.

Thoughts?


https://reviews.llvm.org/D45641





More information about the llvm-commits mailing list