diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-11-11 04:28:40 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-11-11 04:28:40 +0000 |
commit | 41af43092ccc8030bb49cea324d85eecd5ae68a8 (patch) | |
tree | f30038673dd27f2d4785068fffd510abe4fb23d7 /lldb/source/Host | |
parent | e8e98dcb74cd6d297c31c023bfacdf7f28cdaabc (diff) | |
download | bcm5719-llvm-41af43092ccc8030bb49cea324d85eecd5ae68a8.tar.gz bcm5719-llvm-41af43092ccc8030bb49cea324d85eecd5ae68a8.zip |
Make the Error class constructor protected
This is forcing to use Error::success(), which is in a wide majority
of cases a lot more readable.
Differential Revision: https://reviews.llvm.org/D26481
llvm-svn: 286561
Diffstat (limited to 'lldb/source/Host')
-rw-r--r-- | lldb/source/Host/common/NativeBreakpoint.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Host/common/NativeBreakpointList.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Host/common/NativeProcessProtocol.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Host/common/NativeWatchpointList.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Host/common/SoftwareBreakpoint.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Host/posix/FileSystem.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Host/posix/MainLoopPosix.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Host/posix/PipePosix.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Host/windows/LockFileWindows.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Host/windows/PipeWindows.cpp | 8 |
10 files changed, 22 insertions, 22 deletions
diff --git a/lldb/source/Host/common/NativeBreakpoint.cpp b/lldb/source/Host/common/NativeBreakpoint.cpp index d61a2f531ac..a2cc04884a6 100644 --- a/lldb/source/Host/common/NativeBreakpoint.cpp +++ b/lldb/source/Host/common/NativeBreakpoint.cpp @@ -53,7 +53,7 @@ Error NativeBreakpoint::Enable() { log->Printf("NativeBreakpoint::%s addr = 0x%" PRIx64 " already enabled, ignoring.", __FUNCTION__, m_addr); - return Error(); + return Error::success(); } // Log and enable. @@ -85,7 +85,7 @@ Error NativeBreakpoint::Disable() { log->Printf("NativeBreakpoint::%s addr = 0x%" PRIx64 " already disabled, ignoring.", __FUNCTION__, m_addr); - return Error(); + return Error::success(); } // Log and disable. diff --git a/lldb/source/Host/common/NativeBreakpointList.cpp b/lldb/source/Host/common/NativeBreakpointList.cpp index df5bce8079e..58e1c3e9da6 100644 --- a/lldb/source/Host/common/NativeBreakpointList.cpp +++ b/lldb/source/Host/common/NativeBreakpointList.cpp @@ -40,7 +40,7 @@ Error NativeBreakpointList::AddRef(lldb::addr_t addr, size_t size_hint, __FUNCTION__, addr); iter->second->AddRef(); - return Error(); + return Error::success(); } // Create a new breakpoint using the given create func. @@ -205,7 +205,7 @@ Error NativeBreakpointList::GetBreakpoint(lldb::addr_t addr, // Disable it. breakpoint_sp = iter->second; - return Error(); + return Error::success(); } Error NativeBreakpointList::RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, @@ -225,5 +225,5 @@ Error NativeBreakpointList::RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, auto opcode_size = software_bp_sp->m_opcode_size; ::memcpy(opcode_addr, saved_opcodes, opcode_size); } - return Error(); + return Error::success(); } diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp index d77b8b2e974..a22d7f8de7b 100644 --- a/lldb/source/Host/common/NativeProcessProtocol.cpp +++ b/lldb/source/Host/common/NativeProcessProtocol.cpp @@ -405,7 +405,7 @@ Error NativeProcessProtocol::ResolveProcessArchitecture(lldb::pid_t pid, arch = module_specs.GetModuleSpecRefAtIndex(0).GetArchitecture(); if (arch.IsValid()) - return Error(); + return Error::success(); else return Error("failed to retrieve a valid architecture from the exe module"); } diff --git a/lldb/source/Host/common/NativeWatchpointList.cpp b/lldb/source/Host/common/NativeWatchpointList.cpp index 5948adf3c8d..be9d2eba6a3 100644 --- a/lldb/source/Host/common/NativeWatchpointList.cpp +++ b/lldb/source/Host/common/NativeWatchpointList.cpp @@ -17,12 +17,12 @@ using namespace lldb_private; Error NativeWatchpointList::Add(addr_t addr, size_t size, uint32_t watch_flags, bool hardware) { m_watchpoints[addr] = {addr, size, watch_flags, hardware}; - return Error(); + return Error::success(); } Error NativeWatchpointList::Remove(addr_t addr) { m_watchpoints.erase(addr); - return Error(); + return Error::success(); } const NativeWatchpointList::WatchpointMap & diff --git a/lldb/source/Host/common/SoftwareBreakpoint.cpp b/lldb/source/Host/common/SoftwareBreakpoint.cpp index 3d57b7dd6b8..6cb8126fb14 100644 --- a/lldb/source/Host/common/SoftwareBreakpoint.cpp +++ b/lldb/source/Host/common/SoftwareBreakpoint.cpp @@ -103,7 +103,7 @@ Error SoftwareBreakpoint::CreateSoftwareBreakpoint( // breakpoint. breakpoint_sp.reset(new SoftwareBreakpoint(process, addr, saved_opcode_bytes, bp_opcode_bytes, bp_opcode_size)); - return Error(); + return Error::success(); } Error SoftwareBreakpoint::EnableSoftwareBreakpoint( @@ -219,7 +219,7 @@ Error SoftwareBreakpoint::EnableSoftwareBreakpoint( log->Printf("SoftwareBreakpoint::%s addr = 0x%" PRIx64 " -- SUCCESS", __FUNCTION__, addr); - return Error(); + return Error::success(); } // ------------------------------------------------------------------- diff --git a/lldb/source/Host/posix/FileSystem.cpp b/lldb/source/Host/posix/FileSystem.cpp index aaa53ce0772..0567f60a3cb 100644 --- a/lldb/source/Host/posix/FileSystem.cpp +++ b/lldb/source/Host/posix/FileSystem.cpp @@ -62,7 +62,7 @@ Error FileSystem::MakeDirectory(const FileSpec &file_spec, } break; case EEXIST: { if (file_spec.IsDirectory()) - return Error(); // It is a directory and it already exists + return Error::success(); // It is a directory and it already exists } break; } } @@ -210,7 +210,7 @@ Error FileSystem::ResolveSymbolicLink(const FileSpec &src, FileSpec &dst) { dst = FileSpec(real_path, false); - return Error(); + return Error::success(); } #if defined(__NetBSD__) diff --git a/lldb/source/Host/posix/MainLoopPosix.cpp b/lldb/source/Host/posix/MainLoopPosix.cpp index 08c969e72a2..59a76121f6d 100644 --- a/lldb/source/Host/posix/MainLoopPosix.cpp +++ b/lldb/source/Host/posix/MainLoopPosix.cpp @@ -160,7 +160,7 @@ Error MainLoopPosix::Run() { it->second.callback(*this); // Do the work if (m_terminate_request) - return Error(); + return Error::success(); } for (int fd : read_fds) { @@ -175,8 +175,8 @@ Error MainLoopPosix::Run() { it->second(*this); // Do the work if (m_terminate_request) - return Error(); + return Error::success(); } } - return Error(); + return Error::success(); } diff --git a/lldb/source/Host/posix/PipePosix.cpp b/lldb/source/Host/posix/PipePosix.cpp index 4e0810c1a9b..142f6c99cb2 100644 --- a/lldb/source/Host/posix/PipePosix.cpp +++ b/lldb/source/Host/posix/PipePosix.cpp @@ -206,7 +206,7 @@ Error PipePosix::OpenAsWriterWithTimeout( } } - return Error(); + return Error::success(); } int PipePosix::GetReadFileDescriptor() const { return m_fds[READ]; } diff --git a/lldb/source/Host/windows/LockFileWindows.cpp b/lldb/source/Host/windows/LockFileWindows.cpp index 0e7f595e6cf..11096bc648d 100644 --- a/lldb/source/Host/windows/LockFileWindows.cpp +++ b/lldb/source/Host/windows/LockFileWindows.cpp @@ -31,7 +31,7 @@ Error fileLock(HANDLE file_handle, DWORD flags, const uint64_t start, if (!::GetOverlappedResult(file_handle, &overlapped, &bytes, TRUE)) return Error(::GetLastError(), eErrorTypeWin32); - return Error(); + return Error::success(); } } // namespace @@ -74,5 +74,5 @@ Error LockFileWindows::DoUnlock() { if (!::GetOverlappedResult(m_file, &overlapped, &bytes, TRUE)) return Error(::GetLastError(), eErrorTypeWin32); - return Error(); + return Error::success(); } diff --git a/lldb/source/Host/windows/PipeWindows.cpp b/lldb/source/Host/windows/PipeWindows.cpp index 407f0468e6c..64b65847506 100644 --- a/lldb/source/Host/windows/PipeWindows.cpp +++ b/lldb/source/Host/windows/PipeWindows.cpp @@ -161,7 +161,7 @@ Error PipeWindows::OpenNamedPipe(llvm::StringRef name, ZeroMemory(&m_write_overlapped, sizeof(m_write_overlapped)); } - return Error(); + return Error::success(); } int PipeWindows::GetReadFileDescriptor() const { return m_read_fd; } @@ -217,7 +217,7 @@ void PipeWindows::Close() { CloseWriteFileDescriptor(); } -Error PipeWindows::Delete(llvm::StringRef name) { return Error(); } +Error PipeWindows::Delete(llvm::StringRef name) { return Error::success(); } bool PipeWindows::CanRead() const { return (m_read != INVALID_HANDLE_VALUE); } @@ -273,7 +273,7 @@ Error PipeWindows::ReadWithTimeout(void *buf, size_t size, return Error(::GetLastError(), eErrorTypeWin32); bytes_read = sys_bytes_read; - return Error(); + return Error::success(); } Error PipeWindows::Write(const void *buf, size_t num_bytes, @@ -291,5 +291,5 @@ Error PipeWindows::Write(const void *buf, size_t num_bytes, &sys_bytes_written, TRUE); if (!result) return Error(::GetLastError(), eErrorTypeWin32); - return Error(); + return Error::success(); } |