diff options
Diffstat (limited to 'lldb/source/Host')
25 files changed, 0 insertions, 174 deletions
diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp index 54e690d4a47..c9cc5c07e40 100644 --- a/lldb/source/Host/common/Editline.cpp +++ b/lldb/source/Host/common/Editline.cpp @@ -260,9 +260,7 @@ protected: } } -//------------------------------------------------------------------ // Editline private methods -//------------------------------------------------------------------ void Editline::SetBaseLineNumber(int line_number) { std::stringstream line_number_stream; @@ -856,10 +854,8 @@ unsigned char Editline::BufferEndCommand(int ch) { return CC_NEWLINE; } -//------------------------------------------------------------------------------ /// Prints completions and their descriptions to the given file. Only the /// completions in the interval [start, end) are printed. -//------------------------------------------------------------------------------ static void PrintCompletion(FILE *output_file, size_t start, size_t end, StringList &completions, StringList &descriptions) { // This is an 'int' because of printf. @@ -1144,9 +1140,7 @@ void Editline::ConfigureEditor(bool multiline) { } } -//------------------------------------------------------------------ // Editline public methods -//------------------------------------------------------------------ Editline *Editline::InstanceFor(EditLine *editline) { Editline *editor; diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp index bf462135afa..85e625ca78f 100644 --- a/lldb/source/Host/common/File.cpp +++ b/lldb/source/Host/common/File.cpp @@ -621,9 +621,7 @@ Status File::Write(const void *buf, size_t &num_bytes, off_t &offset) { return error; } -//------------------------------------------------------------------ // Print some formatted output to the stream. -//------------------------------------------------------------------ size_t File::Printf(const char *format, ...) { va_list args; va_start(args, format); @@ -632,9 +630,7 @@ size_t File::Printf(const char *format, ...) { return result; } -//------------------------------------------------------------------ // Print some formatted output to the stream. -//------------------------------------------------------------------ size_t File::PrintfVarArg(const char *format, va_list args) { size_t result = 0; if (DescriptorIsValid()) { diff --git a/lldb/source/Host/common/FileAction.cpp b/lldb/source/Host/common/FileAction.cpp index 97367049abb..3268d952bcc 100644 --- a/lldb/source/Host/common/FileAction.cpp +++ b/lldb/source/Host/common/FileAction.cpp @@ -14,9 +14,7 @@ using namespace lldb_private; -//---------------------------------------------------------------------------- // FileAction member functions -//---------------------------------------------------------------------------- FileAction::FileAction() : m_action(eFileActionNone), m_fd(-1), m_arg(-1), m_file_spec() {} diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 2906fe8a908..1cb1c90db46 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -116,10 +116,8 @@ HostThread Host::StartMonitoringChildProcess( } #ifndef __linux__ -//------------------------------------------------------------------ // Scoped class that will disable thread canceling when it is constructed, and // exception safely restore the previous value it when it goes out of scope. -//------------------------------------------------------------------ class ScopedPThreadCancelDisabler { public: ScopedPThreadCancelDisabler() { diff --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp index 388f767de83..130f0eb8ac8 100644 --- a/lldb/source/Host/common/HostInfoBase.cpp +++ b/lldb/source/Host/common/HostInfoBase.cpp @@ -31,13 +31,11 @@ using namespace lldb; using namespace lldb_private; namespace { -//---------------------------------------------------------------------- // The HostInfoBaseFields is a work around for windows not supporting static // variables correctly in a thread safe way. Really each of the variables in // HostInfoBaseFields should live in the functions in which they are used and // each one should be static, but the work around is in place to avoid this // restriction. Ick. -//---------------------------------------------------------------------- struct HostInfoBaseFields { ~HostInfoBaseFields() { diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp index ac460d549e4..90272cb8d0b 100644 --- a/lldb/source/Host/common/NativeProcessProtocol.cpp +++ b/lldb/source/Host/common/NativeProcessProtocol.cpp @@ -19,9 +19,7 @@ using namespace lldb; using namespace lldb_private; -// ----------------------------------------------------------------------------- // NativeProcessProtocol Members -// ----------------------------------------------------------------------------- NativeProcessProtocol::NativeProcessProtocol(lldb::pid_t pid, int terminal_fd, NativeDelegate &delegate) diff --git a/lldb/source/Host/common/NativeRegisterContext.cpp b/lldb/source/Host/common/NativeRegisterContext.cpp index 5b5d717c07e..2f30d52aea6 100644 --- a/lldb/source/Host/common/NativeRegisterContext.cpp +++ b/lldb/source/Host/common/NativeRegisterContext.cpp @@ -21,9 +21,7 @@ using namespace lldb_private; NativeRegisterContext::NativeRegisterContext(NativeThreadProtocol &thread) : m_thread(thread) {} -//---------------------------------------------------------------------- // Destructor -//---------------------------------------------------------------------- NativeRegisterContext::~NativeRegisterContext() {} // FIXME revisit invalidation, process stop ids, etc. Right now we don't diff --git a/lldb/source/Host/common/ProcessLaunchInfo.cpp b/lldb/source/Host/common/ProcessLaunchInfo.cpp index 443f00e65af..ac8a41bf883 100644 --- a/lldb/source/Host/common/ProcessLaunchInfo.cpp +++ b/lldb/source/Host/common/ProcessLaunchInfo.cpp @@ -26,9 +26,7 @@ using namespace lldb; using namespace lldb_private; -//---------------------------------------------------------------------------- // ProcessLaunchInfo member functions -//---------------------------------------------------------------------------- ProcessLaunchInfo::ProcessLaunchInfo() : ProcessInfo(), m_working_dir(), m_plugin_name(), m_flags(0), diff --git a/lldb/source/Host/common/PseudoTerminal.cpp b/lldb/source/Host/common/PseudoTerminal.cpp index c95c1aa3829..85e54f4d3d6 100644 --- a/lldb/source/Host/common/PseudoTerminal.cpp +++ b/lldb/source/Host/common/PseudoTerminal.cpp @@ -26,36 +26,28 @@ int posix_openpt(int flags); using namespace lldb_private; -//---------------------------------------------------------------------- // Write string describing error number -//---------------------------------------------------------------------- static void ErrnoToStr(char *error_str, size_t error_len) { std::string strerror = llvm::sys::StrError(); ::snprintf(error_str, error_len, "%s", strerror.c_str()); } -//---------------------------------------------------------------------- // PseudoTerminal constructor -//---------------------------------------------------------------------- PseudoTerminal::PseudoTerminal() : m_master_fd(invalid_fd), m_slave_fd(invalid_fd) {} -//---------------------------------------------------------------------- // Destructor // // The destructor will close the master and slave file descriptors if they are // valid and ownership has not been released using the // ReleaseMasterFileDescriptor() or the ReleaseSaveFileDescriptor() member // functions. -//---------------------------------------------------------------------- PseudoTerminal::~PseudoTerminal() { CloseMasterFileDescriptor(); CloseSlaveFileDescriptor(); } -//---------------------------------------------------------------------- // Close the master file descriptor if it is valid. -//---------------------------------------------------------------------- void PseudoTerminal::CloseMasterFileDescriptor() { if (m_master_fd >= 0) { ::close(m_master_fd); @@ -63,9 +55,7 @@ void PseudoTerminal::CloseMasterFileDescriptor() { } } -//---------------------------------------------------------------------- // Close the slave file descriptor if it is valid. -//---------------------------------------------------------------------- void PseudoTerminal::CloseSlaveFileDescriptor() { if (m_slave_fd >= 0) { ::close(m_slave_fd); @@ -73,7 +63,6 @@ void PseudoTerminal::CloseSlaveFileDescriptor() { } } -//---------------------------------------------------------------------- // Open the first available pseudo terminal with OFLAG as the permissions. The // file descriptor is stored in this object and can be accessed with the // MasterFileDescriptor() accessor. The ownership of the master file descriptor @@ -85,7 +74,6 @@ void PseudoTerminal::CloseSlaveFileDescriptor() { // // RETURNS: // True when successful, false indicating an error occurred. -//---------------------------------------------------------------------- bool PseudoTerminal::OpenFirstAvailableMaster(int oflag, char *error_str, size_t error_len) { if (error_str) @@ -124,7 +112,6 @@ bool PseudoTerminal::OpenFirstAvailableMaster(int oflag, char *error_str, #endif } -//---------------------------------------------------------------------- // Open the slave pseudo terminal for the current master pseudo terminal. A // master pseudo terminal should already be valid prior to calling this // function (see OpenFirstAvailableMaster()). The file descriptor is stored @@ -134,7 +121,6 @@ bool PseudoTerminal::OpenFirstAvailableMaster(int oflag, char *error_str, // // RETURNS: // True when successful, false indicating an error occurred. -//---------------------------------------------------------------------- bool PseudoTerminal::OpenSlave(int oflag, char *error_str, size_t error_len) { if (error_str) error_str[0] = '\0'; @@ -158,7 +144,6 @@ bool PseudoTerminal::OpenSlave(int oflag, char *error_str, size_t error_len) { return true; } -//---------------------------------------------------------------------- // Get the name of the slave pseudo terminal. A master pseudo terminal should // already be valid prior to calling this function (see // OpenFirstAvailableMaster()). @@ -168,7 +153,6 @@ bool PseudoTerminal::OpenSlave(int oflag, char *error_str, size_t error_len) { // The name of the slave pseudo terminal as a NULL terminated C string // that comes from static memory, so a copy of the string should be // made as subsequent calls can change this value. -//---------------------------------------------------------------------- const char *PseudoTerminal::GetSlaveName(char *error_str, size_t error_len) const { if (error_str) @@ -188,7 +172,6 @@ const char *PseudoTerminal::GetSlaveName(char *error_str, return slave_name; } -//---------------------------------------------------------------------- // Fork a child process and have its stdio routed to a pseudo terminal. // // In the parent process when a valid pid is returned, the master file @@ -206,7 +189,6 @@ const char *PseudoTerminal::GetSlaveName(char *error_str, // RETURNS: // in the parent process: the pid of the child, or -1 if fork fails // in the child process: zero -//---------------------------------------------------------------------- lldb::pid_t PseudoTerminal::Fork(char *error_str, size_t error_len) { if (error_str) error_str[0] = '\0'; @@ -265,7 +247,6 @@ lldb::pid_t PseudoTerminal::Fork(char *error_str, size_t error_len) { return pid; } -//---------------------------------------------------------------------- // The master file descriptor accessor. This object retains ownership of the // master file descriptor when this accessor is used. Use // ReleaseMasterFileDescriptor() if you wish this object to release ownership @@ -273,23 +254,18 @@ lldb::pid_t PseudoTerminal::Fork(char *error_str, size_t error_len) { // // Returns the master file descriptor, or -1 if the master file descriptor is // not currently valid. -//---------------------------------------------------------------------- int PseudoTerminal::GetMasterFileDescriptor() const { return m_master_fd; } -//---------------------------------------------------------------------- // The slave file descriptor accessor. // // Returns the slave file descriptor, or -1 if the slave file descriptor is not // currently valid. -//---------------------------------------------------------------------- int PseudoTerminal::GetSlaveFileDescriptor() const { return m_slave_fd; } -//---------------------------------------------------------------------- // Release ownership of the master pseudo terminal file descriptor without // closing it. The destructor for this class will close the master file // descriptor if the ownership isn't released using this call and the master // file descriptor has been opened. -//---------------------------------------------------------------------- int PseudoTerminal::ReleaseMasterFileDescriptor() { // Release ownership of the master pseudo terminal file descriptor without // closing it. (the destructor for this class will close it otherwise!) @@ -298,12 +274,10 @@ int PseudoTerminal::ReleaseMasterFileDescriptor() { return fd; } -//---------------------------------------------------------------------- // Release ownership of the slave pseudo terminal file descriptor without // closing it. The destructor for this class will close the slave file // descriptor if the ownership isn't released using this call and the slave // file descriptor has been opened. -//---------------------------------------------------------------------- int PseudoTerminal::ReleaseSlaveFileDescriptor() { // Release ownership of the slave pseudo terminal file descriptor without // closing it (the destructor for this class will close it otherwise!) diff --git a/lldb/source/Host/common/SocketAddress.cpp b/lldb/source/Host/common/SocketAddress.cpp index 0868c34972d..46c0639d399 100644 --- a/lldb/source/Host/common/SocketAddress.cpp +++ b/lldb/source/Host/common/SocketAddress.cpp @@ -71,9 +71,7 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size) { using namespace lldb_private; -//---------------------------------------------------------------------- // SocketAddress constructor -//---------------------------------------------------------------------- SocketAddress::SocketAddress() { Clear(); } SocketAddress::SocketAddress(const struct sockaddr &s) { m_socket_addr.sa = s; } @@ -94,15 +92,11 @@ SocketAddress::SocketAddress(const struct addrinfo *addr_info) { *this = addr_info; } -//---------------------------------------------------------------------- // SocketAddress copy constructor -//---------------------------------------------------------------------- SocketAddress::SocketAddress(const SocketAddress &rhs) : m_socket_addr(rhs.m_socket_addr) {} -//---------------------------------------------------------------------- // Destructor -//---------------------------------------------------------------------- SocketAddress::~SocketAddress() {} void SocketAddress::Clear() { @@ -183,9 +177,7 @@ bool SocketAddress::SetPort(uint16_t port) { return false; } -//---------------------------------------------------------------------- // SocketAddress assignment operator -//---------------------------------------------------------------------- const SocketAddress &SocketAddress::operator=(const SocketAddress &rhs) { if (this != &rhs) m_socket_addr = rhs.m_socket_addr; diff --git a/lldb/source/Host/common/Terminal.cpp b/lldb/source/Host/common/Terminal.cpp index aa3d0e6b333..9c60f0d1190 100644 --- a/lldb/source/Host/common/Terminal.cpp +++ b/lldb/source/Host/common/Terminal.cpp @@ -81,9 +81,7 @@ bool Terminal::SetCanonical(bool enabled) { return false; } -//---------------------------------------------------------------------- // Default constructor -//---------------------------------------------------------------------- TerminalState::TerminalState() : m_tty(), m_tflags(-1), #ifdef LLDB_CONFIG_TERMIOS_SUPPORTED @@ -92,9 +90,7 @@ TerminalState::TerminalState() m_process_group(-1) { } -//---------------------------------------------------------------------- // Destructor -//---------------------------------------------------------------------- TerminalState::~TerminalState() {} void TerminalState::Clear() { @@ -106,11 +102,9 @@ void TerminalState::Clear() { m_process_group = -1; } -//---------------------------------------------------------------------- // Save the current state of the TTY for the file descriptor "fd" and if // "save_process_group" is true, attempt to save the process group info for the // TTY. -//---------------------------------------------------------------------- bool TerminalState::Save(int fd, bool save_process_group) { m_tty.SetFileDescriptor(fd); if (m_tty.IsATerminal()) { @@ -141,10 +135,8 @@ bool TerminalState::Save(int fd, bool save_process_group) { return IsValid(); } -//---------------------------------------------------------------------- // Restore the state of the TTY using the cached values from a previous call to // Save(). -//---------------------------------------------------------------------- bool TerminalState::Restore() const { #ifndef LLDB_DISABLE_POSIX if (IsValid()) { @@ -172,23 +164,17 @@ bool TerminalState::Restore() const { return false; } -//---------------------------------------------------------------------- // Returns true if this object has valid saved TTY state settings that can be // used to restore a previous state. -//---------------------------------------------------------------------- bool TerminalState::IsValid() const { return m_tty.FileDescriptorIsValid() && (TFlagsIsValid() || TTYStateIsValid()); } -//---------------------------------------------------------------------- // Returns true if m_tflags is valid -//---------------------------------------------------------------------- bool TerminalState::TFlagsIsValid() const { return m_tflags != -1; } -//---------------------------------------------------------------------- // Returns true if m_ttystate is valid -//---------------------------------------------------------------------- bool TerminalState::TTYStateIsValid() const { #ifdef LLDB_CONFIG_TERMIOS_SUPPORTED return m_termios_up != 0; @@ -197,35 +183,25 @@ bool TerminalState::TTYStateIsValid() const { #endif } -//---------------------------------------------------------------------- // Returns true if m_process_group is valid -//---------------------------------------------------------------------- bool TerminalState::ProcessGroupIsValid() const { return static_cast<int32_t>(m_process_group) != -1; } -//------------------------------------------------------------------ // Constructor -//------------------------------------------------------------------ TerminalStateSwitcher::TerminalStateSwitcher() : m_currentState(UINT32_MAX) {} -//------------------------------------------------------------------ // Destructor -//------------------------------------------------------------------ TerminalStateSwitcher::~TerminalStateSwitcher() {} -//------------------------------------------------------------------ // Returns the number of states that this switcher contains -//------------------------------------------------------------------ uint32_t TerminalStateSwitcher::GetNumberOfStates() const { return llvm::array_lengthof(m_ttystates); } -//------------------------------------------------------------------ // Restore the state at index "idx". // // Returns true if the restore was successful, false otherwise. -//------------------------------------------------------------------ bool TerminalStateSwitcher::Restore(uint32_t idx) const { const uint32_t num_states = GetNumberOfStates(); if (idx >= num_states) @@ -247,12 +223,10 @@ bool TerminalStateSwitcher::Restore(uint32_t idx) const { return false; } -//------------------------------------------------------------------ // Save the state at index "idx" for file descriptor "fd" and save the process // group if requested. // // Returns true if the restore was successful, false otherwise. -//------------------------------------------------------------------ bool TerminalStateSwitcher::Save(uint32_t idx, int fd, bool save_process_group) { const uint32_t num_states = GetNumberOfStates(); diff --git a/lldb/source/Host/macosx/cfcpp/CFCBundle.cpp b/lldb/source/Host/macosx/cfcpp/CFCBundle.cpp index 06057b5ed46..0ca2c00798f 100644 --- a/lldb/source/Host/macosx/cfcpp/CFCBundle.cpp +++ b/lldb/source/Host/macosx/cfcpp/CFCBundle.cpp @@ -9,9 +9,7 @@ #include "CFCBundle.h" #include "CFCString.h" -//---------------------------------------------------------------------- // CFCBundle constructor -//---------------------------------------------------------------------- CFCBundle::CFCBundle(const char *path) : CFCReleaser<CFBundleRef>() { if (path && path[0]) SetPath(path); @@ -20,14 +18,10 @@ CFCBundle::CFCBundle(const char *path) : CFCReleaser<CFBundleRef>() { CFCBundle::CFCBundle(CFURLRef url) : CFCReleaser<CFBundleRef>(url ? CFBundleCreate(NULL, url) : NULL) {} -//---------------------------------------------------------------------- // Destructor -//---------------------------------------------------------------------- CFCBundle::~CFCBundle() {} -//---------------------------------------------------------------------- // Set the path for a bundle by supplying a -//---------------------------------------------------------------------- bool CFCBundle::SetPath(const char *path) { CFAllocatorRef alloc = kCFAllocatorDefault; // Release our old bundle and URL diff --git a/lldb/source/Host/macosx/cfcpp/CFCBundle.h b/lldb/source/Host/macosx/cfcpp/CFCBundle.h index 12516048f47..9ff58fba854 100644 --- a/lldb/source/Host/macosx/cfcpp/CFCBundle.h +++ b/lldb/source/Host/macosx/cfcpp/CFCBundle.h @@ -13,9 +13,7 @@ class CFCBundle : public CFCReleaser<CFBundleRef> { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ CFCBundle(const char *path = NULL); CFCBundle(CFURLRef url); diff --git a/lldb/source/Host/macosx/cfcpp/CFCData.cpp b/lldb/source/Host/macosx/cfcpp/CFCData.cpp index c3deeca2ce9..191f4734c64 100644 --- a/lldb/source/Host/macosx/cfcpp/CFCData.cpp +++ b/lldb/source/Host/macosx/cfcpp/CFCData.cpp @@ -8,19 +8,13 @@ #include "CFCData.h" -//---------------------------------------------------------------------- // CFCData constructor -//---------------------------------------------------------------------- CFCData::CFCData(CFDataRef data) : CFCReleaser<CFDataRef>(data) {} -//---------------------------------------------------------------------- // CFCData copy constructor -//---------------------------------------------------------------------- CFCData::CFCData(const CFCData &rhs) : CFCReleaser<CFDataRef>(rhs) {} -//---------------------------------------------------------------------- // CFCData copy constructor -//---------------------------------------------------------------------- CFCData &CFCData::operator=(const CFCData &rhs) { @@ -29,9 +23,7 @@ CFCData &CFCData::operator=(const CFCData &rhs) return *this; } -//---------------------------------------------------------------------- // Destructor -//---------------------------------------------------------------------- CFCData::~CFCData() {} CFIndex CFCData::GetLength() const { diff --git a/lldb/source/Host/macosx/cfcpp/CFCData.h b/lldb/source/Host/macosx/cfcpp/CFCData.h index b0b25232b1c..33fcf53ed0b 100644 --- a/lldb/source/Host/macosx/cfcpp/CFCData.h +++ b/lldb/source/Host/macosx/cfcpp/CFCData.h @@ -13,9 +13,7 @@ class CFCData : public CFCReleaser<CFDataRef> { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ CFCData(CFDataRef data = NULL); CFCData(const CFCData &rhs); CFCData &operator=(const CFCData &rhs); @@ -26,9 +24,7 @@ public: CFIndex GetLength() const; protected: - //------------------------------------------------------------------ // Classes that inherit from CFCData can see and modify these - //------------------------------------------------------------------ }; #endif // #ifndef CoreFoundationCPP_CFData_h_ diff --git a/lldb/source/Host/macosx/cfcpp/CFCMutableArray.cpp b/lldb/source/Host/macosx/cfcpp/CFCMutableArray.cpp index 75bc12d28ff..a2172c296f6 100644 --- a/lldb/source/Host/macosx/cfcpp/CFCMutableArray.cpp +++ b/lldb/source/Host/macosx/cfcpp/CFCMutableArray.cpp @@ -9,24 +9,18 @@ #include "CFCMutableArray.h" #include "CFCString.h" -//---------------------------------------------------------------------- // CFCString constructor -//---------------------------------------------------------------------- CFCMutableArray::CFCMutableArray(CFMutableArrayRef s) : CFCReleaser<CFMutableArrayRef>(s) {} -//---------------------------------------------------------------------- // CFCMutableArray copy constructor -//---------------------------------------------------------------------- CFCMutableArray::CFCMutableArray(const CFCMutableArray &rhs) : CFCReleaser<CFMutableArrayRef>(rhs) // NOTE: this won't make a copy of the // array, just add a new reference to // it {} -//---------------------------------------------------------------------- // CFCMutableArray copy constructor -//---------------------------------------------------------------------- CFCMutableArray &CFCMutableArray::operator=(const CFCMutableArray &rhs) { if (this != &rhs) *this = rhs; // NOTE: this operator won't make a copy of the array, just add @@ -34,9 +28,7 @@ CFCMutableArray &CFCMutableArray::operator=(const CFCMutableArray &rhs) { return *this; } -//---------------------------------------------------------------------- // Destructor -//---------------------------------------------------------------------- CFCMutableArray::~CFCMutableArray() {} CFIndex CFCMutableArray::GetCount() const { diff --git a/lldb/source/Host/macosx/cfcpp/CFCMutableArray.h b/lldb/source/Host/macosx/cfcpp/CFCMutableArray.h index ba12301d1fd..46c5b912627 100644 --- a/lldb/source/Host/macosx/cfcpp/CFCMutableArray.h +++ b/lldb/source/Host/macosx/cfcpp/CFCMutableArray.h @@ -13,9 +13,7 @@ class CFCMutableArray : public CFCReleaser<CFMutableArrayRef> { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ CFCMutableArray(CFMutableArrayRef array = NULL); CFCMutableArray(const CFCMutableArray &rhs); // This will copy the array // contents into a new array diff --git a/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.cpp b/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.cpp index 93094161382..66d572d2cfc 100644 --- a/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.cpp +++ b/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.cpp @@ -8,21 +8,15 @@ #include "CFCMutableDictionary.h" #include "CFCString.h" -//---------------------------------------------------------------------- // CFCString constructor -//---------------------------------------------------------------------- CFCMutableDictionary::CFCMutableDictionary(CFMutableDictionaryRef s) : CFCReleaser<CFMutableDictionaryRef>(s) {} -//---------------------------------------------------------------------- // CFCMutableDictionary copy constructor -//---------------------------------------------------------------------- CFCMutableDictionary::CFCMutableDictionary(const CFCMutableDictionary &rhs) : CFCReleaser<CFMutableDictionaryRef>(rhs) {} -//---------------------------------------------------------------------- // CFCMutableDictionary copy constructor -//---------------------------------------------------------------------- const CFCMutableDictionary &CFCMutableDictionary:: operator=(const CFCMutableDictionary &rhs) { if (this != &rhs) @@ -30,9 +24,7 @@ operator=(const CFCMutableDictionary &rhs) { return *this; } -//---------------------------------------------------------------------- // Destructor -//---------------------------------------------------------------------- CFCMutableDictionary::~CFCMutableDictionary() {} CFIndex CFCMutableDictionary::GetCount() const { diff --git a/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.h b/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.h index 99849f4dd01..e9b494a5854 100644 --- a/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.h +++ b/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.h @@ -13,16 +13,12 @@ class CFCMutableDictionary : public CFCReleaser<CFMutableDictionaryRef> { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ CFCMutableDictionary(CFMutableDictionaryRef s = NULL); CFCMutableDictionary(const CFCMutableDictionary &rhs); virtual ~CFCMutableDictionary(); - //------------------------------------------------------------------ // Operators - //------------------------------------------------------------------ const CFCMutableDictionary &operator=(const CFCMutableDictionary &rhs); CFIndex GetCount() const; @@ -61,14 +57,10 @@ public: CFMutableDictionaryRef Dictionary(bool can_create); protected: - //------------------------------------------------------------------ // Classes that inherit from CFCMutableDictionary can see and modify these - //------------------------------------------------------------------ private: - //------------------------------------------------------------------ // For CFCMutableDictionary only - //------------------------------------------------------------------ }; #endif // CoreFoundationCPP_CFMutableDictionary_h_ diff --git a/lldb/source/Host/macosx/cfcpp/CFCMutableSet.cpp b/lldb/source/Host/macosx/cfcpp/CFCMutableSet.cpp index bcfa7ce291d..a6517fafb00 100644 --- a/lldb/source/Host/macosx/cfcpp/CFCMutableSet.cpp +++ b/lldb/source/Host/macosx/cfcpp/CFCMutableSet.cpp @@ -9,30 +9,22 @@ #include "CFCMutableSet.h" -//---------------------------------------------------------------------- // CFCString constructor -//---------------------------------------------------------------------- CFCMutableSet::CFCMutableSet(CFMutableSetRef s) : CFCReleaser<CFMutableSetRef>(s) {} -//---------------------------------------------------------------------- // CFCMutableSet copy constructor -//---------------------------------------------------------------------- CFCMutableSet::CFCMutableSet(const CFCMutableSet &rhs) : CFCReleaser<CFMutableSetRef>(rhs) {} -//---------------------------------------------------------------------- // CFCMutableSet copy constructor -//---------------------------------------------------------------------- const CFCMutableSet &CFCMutableSet::operator=(const CFCMutableSet &rhs) { if (this != &rhs) *this = rhs; return *this; } -//---------------------------------------------------------------------- // Destructor -//---------------------------------------------------------------------- CFCMutableSet::~CFCMutableSet() {} CFIndex CFCMutableSet::GetCount() const { diff --git a/lldb/source/Host/macosx/cfcpp/CFCMutableSet.h b/lldb/source/Host/macosx/cfcpp/CFCMutableSet.h index 5aabaffe664..a55d646be6e 100644 --- a/lldb/source/Host/macosx/cfcpp/CFCMutableSet.h +++ b/lldb/source/Host/macosx/cfcpp/CFCMutableSet.h @@ -13,16 +13,12 @@ class CFCMutableSet : public CFCReleaser<CFMutableSetRef> { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ CFCMutableSet(CFMutableSetRef s = NULL); CFCMutableSet(const CFCMutableSet &rhs); virtual ~CFCMutableSet(); - //------------------------------------------------------------------ // Operators - //------------------------------------------------------------------ const CFCMutableSet &operator=(const CFCMutableSet &rhs); CFIndex GetCount() const; @@ -33,14 +29,10 @@ public: void RemoveAllValues(); protected: - //------------------------------------------------------------------ // Classes that inherit from CFCMutableSet can see and modify these - //------------------------------------------------------------------ private: - //------------------------------------------------------------------ // For CFCMutableSet only - //------------------------------------------------------------------ }; #endif // CoreFoundationCPP_CFMutableSet_h_ diff --git a/lldb/source/Host/macosx/cfcpp/CFCReleaser.h b/lldb/source/Host/macosx/cfcpp/CFCReleaser.h index 816dba8813b..8a29f398021 100644 --- a/lldb/source/Host/macosx/cfcpp/CFCReleaser.h +++ b/lldb/source/Host/macosx/cfcpp/CFCReleaser.h @@ -15,7 +15,6 @@ #include <assert.h> -//---------------------------------------------------------------------- // Templatized CF helper class that can own any CF pointer and will // call CFRelease() on any valid pointer it owns unless that pointer is // explicitly released using the release() member function. This class @@ -24,42 +23,33 @@ // CFCReleaser<T>::release() function won't actually CFRelease any owned // pointer, it is designed to relinquish ownership of the pointer just // like std:auto_ptr<T>::release() does. -//---------------------------------------------------------------------- template <class T> class CFCReleaser { public: - //---------------------------------------------------------- // Constructor that takes a pointer to a CF object that is // to be released when this object goes out of scope - //---------------------------------------------------------- CFCReleaser(T ptr = NULL) : _ptr(ptr) {} - //---------------------------------------------------------- // Copy constructor // // Note that copying a CFCReleaser will not transfer // ownership of the contained pointer, but it will bump its // reference count. This is where this class differs from // std::auto_ptr. - //---------------------------------------------------------- CFCReleaser(const CFCReleaser &rhs) : _ptr(rhs.get()) { if (get()) ::CFRetain(get()); } - //---------------------------------------------------------- // The destructor will release the pointer that it contains // if it has a valid pointer. - //---------------------------------------------------------- virtual ~CFCReleaser() { reset(); } - //---------------------------------------------------------- // Assignment operator. // // Note that assigning one CFCReleaser to another will // not transfer ownership of the contained pointer, but it // will bump its reference count. This is where this class // differs from std::auto_ptr. - //---------------------------------------------------------- CFCReleaser &operator=(const CFCReleaser<T> &rhs) { if (this != &rhs) { // Replace our owned pointer with the new one @@ -71,7 +61,6 @@ public: return *this; } - //---------------------------------------------------------- // Get the address of the contained type in case it needs // to be passed to a function that will fill in a pointer // value. The function currently will assert if _ptr is not @@ -83,36 +72,29 @@ public: // sure any owned objects has CFRelease called on it. // I had to add the "enforce_null" bool here because some // API's require the pointer address even though they don't change it. - //---------------------------------------------------------- T *ptr_address(bool enforce_null = true) { if (enforce_null) assert(_ptr == NULL); return &_ptr; } - //---------------------------------------------------------- // Access the pointer itself - //---------------------------------------------------------- T get() { return _ptr; } const T get() const { return _ptr; } - //---------------------------------------------------------- // Set a new value for the pointer and CFRelease our old // value if we had a valid one. - //---------------------------------------------------------- void reset(T ptr = NULL) { if ((_ptr != NULL) && (ptr != _ptr)) ::CFRelease(_ptr); _ptr = ptr; } - //---------------------------------------------------------- // Release ownership without calling CFRelease. This class // is designed to mimic std::auto_ptr<T>, so the release // method releases ownership of the contained pointer // and does NOT call CFRelease. - //---------------------------------------------------------- T release() { T tmp = _ptr; _ptr = NULL; diff --git a/lldb/source/Host/macosx/cfcpp/CFCString.cpp b/lldb/source/Host/macosx/cfcpp/CFCString.cpp index a0768755f11..fbd33fc7224 100644 --- a/lldb/source/Host/macosx/cfcpp/CFCString.cpp +++ b/lldb/source/Host/macosx/cfcpp/CFCString.cpp @@ -10,19 +10,13 @@ #include <glob.h> #include <string> -//---------------------------------------------------------------------- // CFCString constructor -//---------------------------------------------------------------------- CFCString::CFCString(CFStringRef s) : CFCReleaser<CFStringRef>(s) {} -//---------------------------------------------------------------------- // CFCString copy constructor -//---------------------------------------------------------------------- CFCString::CFCString(const CFCString &rhs) : CFCReleaser<CFStringRef>(rhs) {} -//---------------------------------------------------------------------- // CFCString copy constructor -//---------------------------------------------------------------------- CFCString &CFCString::operator=(const CFCString &rhs) { if (this != &rhs) *this = rhs; @@ -37,9 +31,7 @@ CFCString::CFCString(const char *cstr, CFStringEncoding cstr_encoding) } } -//---------------------------------------------------------------------- // Destructor -//---------------------------------------------------------------------- CFCString::~CFCString() {} const char *CFCString::GetFileSystemRepresentation(std::string &s) { diff --git a/lldb/source/Host/macosx/cfcpp/CFCString.h b/lldb/source/Host/macosx/cfcpp/CFCString.h index 2ed860fa20f..300b1c4a413 100644 --- a/lldb/source/Host/macosx/cfcpp/CFCString.h +++ b/lldb/source/Host/macosx/cfcpp/CFCString.h @@ -15,9 +15,7 @@ class CFCString : public CFCReleaser<CFStringRef> { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ CFCString(CFStringRef cf_str = NULL); CFCString(const char *s, CFStringEncoding encoding = kCFStringEncodingUTF8); CFCString(const CFCString &rhs); diff --git a/lldb/source/Host/macosx/cfcpp/CoreFoundationCPP.h b/lldb/source/Host/macosx/cfcpp/CoreFoundationCPP.h index 5a2e3996f10..0c2b82a34a3 100644 --- a/lldb/source/Host/macosx/cfcpp/CoreFoundationCPP.h +++ b/lldb/source/Host/macosx/cfcpp/CoreFoundationCPP.h @@ -5,7 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -//---------------------------------------------------------------------- // // CoreFoundationCPP.h // CoreFoundationCPP @@ -13,7 +12,6 @@ // Created by Greg Clayton on 4/23/09. // // -//---------------------------------------------------------------------- #ifndef CoreFoundationCPP_CoreFoundationCPP_H_ #define CoreFoundationCPP_CoreFoundationCPP_H_ |