diff options
author | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
---|---|---|
committer | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
commit | b9c1b51e45b845debb76d8658edabca70ca56079 (patch) | |
tree | dfcb5a13ef2b014202340f47036da383eaee74aa /lldb/source/Host/windows/HostInfoWindows.cpp | |
parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
download | bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip |
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
Diffstat (limited to 'lldb/source/Host/windows/HostInfoWindows.cpp')
-rw-r--r-- | lldb/source/Host/windows/HostInfoWindows.cpp | 171 |
1 files changed, 76 insertions, 95 deletions
diff --git a/lldb/source/Host/windows/HostInfoWindows.cpp b/lldb/source/Host/windows/HostInfoWindows.cpp index 6b219029408..a965ec0ea4e 100644 --- a/lldb/source/Host/windows/HostInfoWindows.cpp +++ b/lldb/source/Host/windows/HostInfoWindows.cpp @@ -24,127 +24,108 @@ using namespace lldb_private; FileSpec HostInfoWindows::m_program_filespec; -void -HostInfoWindows::Initialize() -{ - ::CoInitializeEx(nullptr, COINIT_MULTITHREADED); - HostInfoBase::Initialize(); +void HostInfoWindows::Initialize() { + ::CoInitializeEx(nullptr, COINIT_MULTITHREADED); + HostInfoBase::Initialize(); } -void -HostInfoWindows::Terminate() -{ - HostInfoBase::Terminate(); - ::CoUninitialize(); +void HostInfoWindows::Terminate() { + HostInfoBase::Terminate(); + ::CoUninitialize(); } -size_t -HostInfoWindows::GetPageSize() -{ - SYSTEM_INFO systemInfo; - GetNativeSystemInfo(&systemInfo); - return systemInfo.dwPageSize; +size_t HostInfoWindows::GetPageSize() { + SYSTEM_INFO systemInfo; + GetNativeSystemInfo(&systemInfo); + return systemInfo.dwPageSize; } -bool -HostInfoWindows::GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update) -{ - OSVERSIONINFOEX info; +bool HostInfoWindows::GetOSVersion(uint32_t &major, uint32_t &minor, + uint32_t &update) { + OSVERSIONINFOEX info; - ZeroMemory(&info, sizeof(OSVERSIONINFOEX)); - info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + ZeroMemory(&info, sizeof(OSVERSIONINFOEX)); + info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); #pragma warning(push) #pragma warning(disable : 4996) - // Starting with Microsoft SDK for Windows 8.1, this function is deprecated in favor of the - // new Windows Version Helper APIs. Since we don't specify a minimum SDK version, it's easier - // to simply disable the warning rather than try to support both APIs. - if (GetVersionEx((LPOSVERSIONINFO)&info) == 0) - { - return false; - } + // Starting with Microsoft SDK for Windows 8.1, this function is deprecated in + // favor of the + // new Windows Version Helper APIs. Since we don't specify a minimum SDK + // version, it's easier + // to simply disable the warning rather than try to support both APIs. + if (GetVersionEx((LPOSVERSIONINFO)&info) == 0) { + return false; + } #pragma warning(pop) - major = info.dwMajorVersion; - minor = info.dwMinorVersion; - update = info.wServicePackMajor; + major = info.dwMajorVersion; + minor = info.dwMinorVersion; + update = info.wServicePackMajor; - return true; + return true; } -bool -HostInfoWindows::GetOSBuildString(std::string &s) -{ - s.clear(); - uint32_t major, minor, update; - if (!GetOSVersion(major, minor, update)) - return false; - - llvm::raw_string_ostream stream(s); - stream << "Windows NT " << major << "." << minor << "." << update; - return true; +bool HostInfoWindows::GetOSBuildString(std::string &s) { + s.clear(); + uint32_t major, minor, update; + if (!GetOSVersion(major, minor, update)) + return false; + + llvm::raw_string_ostream stream(s); + stream << "Windows NT " << major << "." << minor << "." << update; + return true; } -bool -HostInfoWindows::GetOSKernelDescription(std::string &s) -{ - return GetOSBuildString(s); +bool HostInfoWindows::GetOSKernelDescription(std::string &s) { + return GetOSBuildString(s); } -bool -HostInfoWindows::GetHostname(std::string &s) -{ - wchar_t buffer[MAX_COMPUTERNAME_LENGTH + 1]; - DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; - if (!::GetComputerNameW(buffer, &dwSize)) - return false; +bool HostInfoWindows::GetHostname(std::string &s) { + wchar_t buffer[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; + if (!::GetComputerNameW(buffer, &dwSize)) + return false; - return llvm::convertWideToUTF8(buffer, s); + return llvm::convertWideToUTF8(buffer, s); } -FileSpec -HostInfoWindows::GetProgramFileSpec() -{ - static std::once_flag g_once_flag; - std::call_once(g_once_flag, []() { - std::vector<wchar_t> buffer(PATH_MAX); - ::GetModuleFileNameW(NULL, buffer.data(), buffer.size()); - std::string path; - llvm::convertWideToUTF8(buffer.data(), path); - m_program_filespec.SetFile(path, false); - }); - return m_program_filespec; +FileSpec HostInfoWindows::GetProgramFileSpec() { + static std::once_flag g_once_flag; + std::call_once(g_once_flag, []() { + std::vector<wchar_t> buffer(PATH_MAX); + ::GetModuleFileNameW(NULL, buffer.data(), buffer.size()); + std::string path; + llvm::convertWideToUTF8(buffer.data(), path); + m_program_filespec.SetFile(path, false); + }); + return m_program_filespec; } -FileSpec -HostInfoWindows::GetDefaultShell() -{ - std::string shell; - GetEnvironmentVar("ComSpec", shell); - return FileSpec(shell, false); +FileSpec HostInfoWindows::GetDefaultShell() { + std::string shell; + GetEnvironmentVar("ComSpec", shell); + return FileSpec(shell, false); } -bool -HostInfoWindows::ComputePythonDirectory(FileSpec &file_spec) -{ - FileSpec lldb_file_spec; - if (!GetLLDBPath(lldb::ePathTypeLLDBShlibDir, lldb_file_spec)) - return false; - llvm::SmallString<64> path(lldb_file_spec.GetDirectory().AsCString()); - llvm::sys::path::remove_filename(path); - llvm::sys::path::append(path, "lib", "site-packages"); - std::replace(path.begin(), path.end(), '\\', '/'); - file_spec.GetDirectory().SetString(path.c_str()); - return true; +bool HostInfoWindows::ComputePythonDirectory(FileSpec &file_spec) { + FileSpec lldb_file_spec; + if (!GetLLDBPath(lldb::ePathTypeLLDBShlibDir, lldb_file_spec)) + return false; + llvm::SmallString<64> path(lldb_file_spec.GetDirectory().AsCString()); + llvm::sys::path::remove_filename(path); + llvm::sys::path::append(path, "lib", "site-packages"); + std::replace(path.begin(), path.end(), '\\', '/'); + file_spec.GetDirectory().SetString(path.c_str()); + return true; } -bool -HostInfoWindows::GetEnvironmentVar(const std::string &var_name, std::string &var) -{ - std::wstring wvar_name; - if (!llvm::ConvertUTF8toWide(var_name, wvar_name)) - return false; - - if (const wchar_t *wvar = _wgetenv(wvar_name.c_str())) - return llvm::convertWideToUTF8(wvar, var); +bool HostInfoWindows::GetEnvironmentVar(const std::string &var_name, + std::string &var) { + std::wstring wvar_name; + if (!llvm::ConvertUTF8toWide(var_name, wvar_name)) return false; + + if (const wchar_t *wvar = _wgetenv(wvar_name.c_str())) + return llvm::convertWideToUTF8(wvar, var); + return false; } |