Remove dead code. Improve llvm_unreachable text. Simplify some control flow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150918 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ahmed Charles
2012-02-19 11:37:01 +00:00
parent d7ace3f8d1
commit b0934ab7d8
21 changed files with 24 additions and 138 deletions

View File

@@ -211,19 +211,6 @@ static error_code GetFileNameFromHandle(HANDLE FileHandle,
}
}
static std::string QuoteProgramPathIfNeeded(StringRef Command) {
if (Command.find_first_of(' ') == StringRef::npos)
return Command;
else {
std::string ret;
ret.reserve(Command.size() + 3);
ret.push_back('"');
ret.append(Command.begin(), Command.end());
ret.push_back('"');
return ret;
}
}
/// @brief Find program using shell lookup rules.
/// @param Program This is either an absolute path, relative path, or simple a
/// program name. Look in PATH for any programs that match. If no
@@ -269,39 +256,6 @@ static std::string FindProgram(const std::string &Program, error_code &ec) {
return PathName;
}
static error_code EnableDebugPrivileges() {
HANDLE TokenHandle;
BOOL success = ::OpenProcessToken(::GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
&TokenHandle);
if (!success)
return windows_error(::GetLastError());
TokenScopedHandle Token(TokenHandle);
TOKEN_PRIVILEGES TokenPrivileges;
LUID LocallyUniqueID;
success = ::LookupPrivilegeValueA(NULL,
SE_DEBUG_NAME,
&LocallyUniqueID);
if (!success)
return windows_error(::GetLastError());
TokenPrivileges.PrivilegeCount = 1;
TokenPrivileges.Privileges[0].Luid = LocallyUniqueID;
TokenPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
success = ::AdjustTokenPrivileges(Token,
FALSE,
&TokenPrivileges,
sizeof(TOKEN_PRIVILEGES),
NULL,
NULL);
// The value of success is basically useless. Either way we are just returning
// the value of ::GetLastError().
return windows_error(::GetLastError());
}
static StringRef ExceptionCodeToString(DWORD ExceptionCode) {
switch(ExceptionCode) {
case EXCEPTION_ACCESS_VIOLATION: return "EXCEPTION_ACCESS_VIOLATION";