Rename sys::Process::GetArgumentVector -> sys::windows::GetCommandLineArguments

GetArgumentVector (or GetCommandLineArguments) is very Windows-specific.
I think it doesn't make much sense to provide that function from sys::Process.

I also made a change so that the function takes a BumpPtrAllocator
instead of a SpecificBumpPtrAllocator. The latter is the class to call
dtors, but since char * is trivially destructible, we should use the
former class.

Differential Revision: https://reviews.llvm.org/D45641

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330216 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rui Ueyama
2018-04-17 21:09:16 +00:00
parent 7f57949cd0
commit 3e79068e73
6 changed files with 40 additions and 49 deletions
+8 -4
View File
@@ -15,7 +15,12 @@
#include "llvm/Support/Signals.h"
#include <string>
#ifdef _WIN32
#include "Windows/WindowsSupport.h"
#endif
using namespace llvm;
using namespace llvm::sys;
InitLLVM::InitLLVM(int &Argc, const char **&Argv) : StackPrinter(Argc, Argv) {
sys::PrintStackTraceOnErrorSignal(Argv[0]);
@@ -33,11 +38,10 @@ InitLLVM::InitLLVM(int &Argc, const char **&Argv) : StackPrinter(Argc, Argv) {
std::string Banner = std::string(Argv[0]) + ": ";
ExitOnError ExitOnErr(Banner);
ExitOnErr(errorCodeToError(
sys::Process::GetArgumentVector(Args, makeArrayRef(Argv, Argc), Alloc)));
ExitOnErr(errorCodeToError(windows::GetCommandLineArguments(Args, Alloc)));
// GetArgumentVector doesn't terminate the vector with a nullptr.
// Do it to make it compatible with the real argv.
// GetCommandLineArguments doesn't terminate the vector with a
// nullptr. Do it to make it compatible with the real argv.
Args.push_back(nullptr);
Argc = Args.size() - 1;