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/API/SBHostOS.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/API/SBHostOS.cpp')
-rw-r--r-- | lldb/source/API/SBHostOS.cpp | 167 |
1 files changed, 71 insertions, 96 deletions
diff --git a/lldb/source/API/SBHostOS.cpp b/lldb/source/API/SBHostOS.cpp index 6c172997bdc..8df74d931ec 100644 --- a/lldb/source/API/SBHostOS.cpp +++ b/lldb/source/API/SBHostOS.cpp @@ -9,133 +9,108 @@ #include "lldb/API/SBHostOS.h" #include "lldb/API/SBError.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Core/Log.h" +#include "lldb/Host/FileSpec.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/HostNativeThread.h" #include "lldb/Host/HostThread.h" #include "lldb/Host/ThreadLauncher.h" -#include "llvm/Support/Path.h" #include "llvm/ADT/SmallString.h" +#include "llvm/Support/Path.h" using namespace lldb; using namespace lldb_private; +SBFileSpec SBHostOS::GetProgramFileSpec() { + SBFileSpec sb_filespec; + sb_filespec.SetFileSpec(HostInfo::GetProgramFileSpec()); + return sb_filespec; +} - -SBFileSpec -SBHostOS::GetProgramFileSpec () -{ - SBFileSpec sb_filespec; - sb_filespec.SetFileSpec(HostInfo::GetProgramFileSpec()); - return sb_filespec; +SBFileSpec SBHostOS::GetLLDBPythonPath() { + SBFileSpec sb_lldb_python_filespec; + FileSpec lldb_python_spec; + if (HostInfo::GetLLDBPath(ePathTypePythonDir, lldb_python_spec)) { + sb_lldb_python_filespec.SetFileSpec(lldb_python_spec); + } + return sb_lldb_python_filespec; } -SBFileSpec -SBHostOS::GetLLDBPythonPath () -{ - SBFileSpec sb_lldb_python_filespec; - FileSpec lldb_python_spec; - if (HostInfo::GetLLDBPath(ePathTypePythonDir, lldb_python_spec)) - { - sb_lldb_python_filespec.SetFileSpec (lldb_python_spec); - } - return sb_lldb_python_filespec; +SBFileSpec SBHostOS::GetLLDBPath(lldb::PathType path_type) { + SBFileSpec sb_fspec; + FileSpec fspec; + if (HostInfo::GetLLDBPath(path_type, fspec)) + sb_fspec.SetFileSpec(fspec); + return sb_fspec; } +SBFileSpec SBHostOS::GetUserHomeDirectory() { + SBFileSpec sb_fspec; -SBFileSpec -SBHostOS::GetLLDBPath (lldb::PathType path_type) -{ - SBFileSpec sb_fspec; - FileSpec fspec; - if (HostInfo::GetLLDBPath(path_type, fspec)) - sb_fspec.SetFileSpec (fspec); - return sb_fspec; + llvm::SmallString<64> home_dir_path; + llvm::sys::path::home_directory(home_dir_path); + FileSpec homedir(home_dir_path.c_str(), true); + + sb_fspec.SetFileSpec(homedir); + return sb_fspec; } -SBFileSpec -SBHostOS::GetUserHomeDirectory () -{ - SBFileSpec sb_fspec; +lldb::thread_t SBHostOS::ThreadCreate(const char *name, + lldb::thread_func_t thread_function, + void *thread_arg, SBError *error_ptr) { + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); - llvm::SmallString<64> home_dir_path; - llvm::sys::path::home_directory (home_dir_path); - FileSpec homedir (home_dir_path.c_str(), true); + if (log) + log->Printf( + "SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, " + "thread_arg=%p, error_ptr=%p)", + name, + reinterpret_cast<void *>(reinterpret_cast<intptr_t>(thread_function)), + static_cast<void *>(thread_arg), static_cast<void *>(error_ptr)); - sb_fspec.SetFileSpec (homedir); - return sb_fspec; -} + // FIXME: You should log the return value? -lldb::thread_t -SBHostOS::ThreadCreate -( - const char *name, - lldb::thread_func_t thread_function, - void *thread_arg, - SBError *error_ptr -) -{ - Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - - if (log) - log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)", - name, reinterpret_cast<void*>(reinterpret_cast<intptr_t>(thread_function)), - static_cast<void*>(thread_arg), - static_cast<void*>(error_ptr)); - - // FIXME: You should log the return value? - - HostThread thread(ThreadLauncher::LaunchThread(name, thread_function, thread_arg, error_ptr ? error_ptr->get() : NULL)); - return thread.Release(); + HostThread thread(ThreadLauncher::LaunchThread( + name, thread_function, thread_arg, error_ptr ? error_ptr->get() : NULL)); + return thread.Release(); } -void -SBHostOS::ThreadCreated (const char *name) -{ -} +void SBHostOS::ThreadCreated(const char *name) {} -bool -SBHostOS::ThreadCancel (lldb::thread_t thread, SBError *error_ptr) -{ - Error error; - HostThread host_thread(thread); - error = host_thread.Cancel(); - if (error_ptr) - error_ptr->SetError(error); - host_thread.Release(); - return error.Success(); +bool SBHostOS::ThreadCancel(lldb::thread_t thread, SBError *error_ptr) { + Error error; + HostThread host_thread(thread); + error = host_thread.Cancel(); + if (error_ptr) + error_ptr->SetError(error); + host_thread.Release(); + return error.Success(); } -bool -SBHostOS::ThreadDetach (lldb::thread_t thread, SBError *error_ptr) -{ - Error error; +bool SBHostOS::ThreadDetach(lldb::thread_t thread, SBError *error_ptr) { + Error error; #if defined(_WIN32) - if (error_ptr) - error_ptr->SetErrorString("ThreadDetach is not supported on this platform"); + if (error_ptr) + error_ptr->SetErrorString("ThreadDetach is not supported on this platform"); #else - HostThread host_thread(thread); - error = host_thread.GetNativeThread().Detach(); - if (error_ptr) - error_ptr->SetError(error); - host_thread.Release(); + HostThread host_thread(thread); + error = host_thread.GetNativeThread().Detach(); + if (error_ptr) + error_ptr->SetError(error); + host_thread.Release(); #endif - return error.Success(); + return error.Success(); } -bool -SBHostOS::ThreadJoin (lldb::thread_t thread, lldb::thread_result_t *result, SBError *error_ptr) -{ - Error error; - HostThread host_thread(thread); - error = host_thread.Join(result); - if (error_ptr) - error_ptr->SetError(error); - host_thread.Release(); - return error.Success(); +bool SBHostOS::ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result, + SBError *error_ptr) { + Error error; + HostThread host_thread(thread); + error = host_thread.Join(result); + if (error_ptr) + error_ptr->SetError(error); + host_thread.Release(); + return error.Success(); } - - |