diff options
author | Zachary Turner <zturner@google.com> | 2018-06-08 15:16:25 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2018-06-08 15:16:25 +0000 |
commit | 66ef5d3cd6c343f1be29c863b94156ebddbc2802 (patch) | |
tree | 85d2ac192aa1791709067906a40a014de2e3b1c2 /llvm/lib/Support/Windows | |
parent | 6edfecb88380862166c72e0ac5dbcaba6538ec58 (diff) | |
download | bcm5719-llvm-66ef5d3cd6c343f1be29c863b94156ebddbc2802.tar.gz bcm5719-llvm-66ef5d3cd6c343f1be29c863b94156ebddbc2802.zip |
Clean up some code in Program.
NFC here, this just raises some platform specific ifdef hackery
out of a class and creates proper platform-independent typedefs
for the relevant things. This allows these typedefs to be
reused in other places without having to reinvent this preprocessor
logic.
llvm-svn: 334294
Diffstat (limited to 'llvm/lib/Support/Windows')
-rw-r--r-- | llvm/lib/Support/Windows/Program.inc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/Support/Windows/Program.inc b/llvm/lib/Support/Windows/Program.inc index 0dcd305d1eb..183b66ce2c0 100644 --- a/llvm/lib/Support/Windows/Program.inc +++ b/llvm/lib/Support/Windows/Program.inc @@ -31,7 +31,7 @@ namespace llvm { -ProcessInfo::ProcessInfo() : ProcessHandle(0), Pid(0), ReturnCode(0) {} +ProcessInfo::ProcessInfo() : Process(0), Pid(0), ReturnCode(0) {} ErrorOr<std::string> sys::findProgramByName(StringRef Name, ArrayRef<StringRef> Paths) { @@ -381,7 +381,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program, const char **Args, } PI.Pid = pi.dwProcessId; - PI.ProcessHandle = pi.hProcess; + PI.Process = pi.hProcess; // Make sure these get closed no matter what. ScopedCommonHandle hThread(pi.hThread); @@ -418,7 +418,7 @@ namespace llvm { ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait, bool WaitUntilChildTerminates, std::string *ErrMsg) { assert(PI.Pid && "invalid pid to wait on, process not started?"); - assert(PI.ProcessHandle && + assert((PI.Process && PI.Process != INVALID_HANDLE_VALUE) && "invalid process handle to wait on, process not started?"); DWORD milliSecondsToWait = 0; if (WaitUntilChildTerminates) @@ -427,20 +427,20 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait, milliSecondsToWait = SecondsToWait * 1000; ProcessInfo WaitResult = PI; - DWORD WaitStatus = WaitForSingleObject(PI.ProcessHandle, milliSecondsToWait); + DWORD WaitStatus = WaitForSingleObject(PI.Process, milliSecondsToWait); if (WaitStatus == WAIT_TIMEOUT) { if (SecondsToWait) { - if (!TerminateProcess(PI.ProcessHandle, 1)) { + if (!TerminateProcess(PI.Process, 1)) { if (ErrMsg) MakeErrMsg(ErrMsg, "Failed to terminate timed-out program"); // -2 indicates a crash or timeout as opposed to failure to execute. WaitResult.ReturnCode = -2; - CloseHandle(PI.ProcessHandle); + CloseHandle(PI.Process); return WaitResult; } - WaitForSingleObject(PI.ProcessHandle, INFINITE); - CloseHandle(PI.ProcessHandle); + WaitForSingleObject(PI.Process, INFINITE); + CloseHandle(PI.Process); } else { // Non-blocking wait. return ProcessInfo(); @@ -449,10 +449,10 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait, // Get its exit status. DWORD status; - BOOL rc = GetExitCodeProcess(PI.ProcessHandle, &status); + BOOL rc = GetExitCodeProcess(PI.Process, &status); DWORD err = GetLastError(); if (err != ERROR_INVALID_HANDLE) - CloseHandle(PI.ProcessHandle); + CloseHandle(PI.Process); if (!rc) { SetLastError(err); |