llvm.org GIT mirror llvm / 01d3cb8
Fix the build of KillTheDoctor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210843 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
1 changed file(s) with 11 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
169169 typedef ScopedHandle FileScopedHandle;
170170 }
171171
172 static error_code windows_error(DWORD E) { return mapWindowsError(E); }
173
174 static error_code GetFileNameFromHandle(HANDLE FileHandle,
175 std::string& Name) {
172 static std::error_code windows_error(DWORD E) { return mapWindowsError(E); }
173
174 static std::error_code GetFileNameFromHandle(HANDLE FileHandle,
175 std::string &Name) {
176176 char Filename[MAX_PATH+1];
177177 bool Success = false;
178178 Name.clear();
212212 return windows_error(::GetLastError());
213213 else {
214214 Name = Filename;
215 return error_code();
215 return std::error_code();
216216 }
217217 }
218218
222222 /// extension is present, try all extensions in PATHEXT.
223223 /// @return If ec == errc::success, The absolute path to the program. Otherwise
224224 /// the return value is undefined.
225 static std::string FindProgram(const std::string &Program, error_code &ec) {
225 static std::string FindProgram(const std::string &Program,
226 std::error_code &ec) {
226227 char PathName[MAX_PATH + 1];
227228 typedef SmallVector pathext_t;
228229 pathext_t pathext;
251252 break;
252253 } else {
253254 // We found the path! Return it.
254 ec = error_code();
255 ec = std::error_code();
255256 break;
256257 }
257258 }
314315
315316 std::string CommandLine(ProgramToRun);
316317
317 error_code ec;
318 std::error_code ec;
318319 ProgramToRun = FindProgram(ProgramToRun, ec);
319320 if (ec) {
320321 errs() << ToolName << ": Failed to find program: '" << CommandLine
358359 &StartupInfo,
359360 &ProcessInfo);
360361 if (!success) {
361 errs() << ToolName << ": Failed to run program: '" << ProgramToRun
362 << "': " << error_code(windows_error(::GetLastError())).message()
362 errs() << ToolName << ": Failed to run program: '" << ProgramToRun << "': "
363 << std::error_code(windows_error(::GetLastError())).message()
363364 << '\n';
364365 return -1;
365366 }