[lldb][NFC] Use UNUSED_IF_ASSERT_DISABLED instead of (void) cast
Uses of (void) remain where they are for purposes other than an assert variable.
This commit is contained in:
parent
ee9220c8e3
commit
68fbc8eec3
@ -183,7 +183,7 @@ DecodedCharBuffer GetPrintableImpl<StringElementType::UTF8>(
|
||||
&buffer_for_conversion, buffer_end, &codepoint, llvm::strictConversion);
|
||||
assert(result == llvm::conversionOK &&
|
||||
"Failed to convert legal utf8 sequence");
|
||||
(void)result;
|
||||
UNUSED_IF_ASSERT_DISABLED(result);
|
||||
|
||||
// The UTF8 helper always advances by the utf8 encoded length.
|
||||
const unsigned utf8_encoded_len = buffer_for_conversion - buffer;
|
||||
|
||||
@ -1509,7 +1509,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
|
||||
size_t dataSize = 0;
|
||||
|
||||
bool Success = execution_unit.GetAllocSize(addr, dataSize);
|
||||
(void)Success;
|
||||
UNUSED_IF_ASSERT_DISABLED(Success);
|
||||
assert(Success &&
|
||||
"unable to locate host data for transfer to device");
|
||||
// Create the required buffer
|
||||
|
||||
@ -123,7 +123,7 @@ std::string PseudoTerminal::GetSecondaryName() const {
|
||||
char buf[PATH_MAX];
|
||||
buf[0] = '\0';
|
||||
int r = ptsname_r(m_primary_fd, buf, sizeof(buf));
|
||||
(void)r;
|
||||
UNUSED_IF_ASSERT_DISABLED(r);
|
||||
assert(r == 0);
|
||||
return buf;
|
||||
#if defined(__APPLE__)
|
||||
|
||||
@ -510,7 +510,7 @@ ConnectionFileDescriptor::BytesAvailable(const Timeout<std::micro> &timeout,
|
||||
ssize_t bytes_read =
|
||||
llvm::sys::RetryAfterSignal(-1, ::read, pipe_fd, &c, 1);
|
||||
assert(bytes_read == 1);
|
||||
(void)bytes_read;
|
||||
UNUSED_IF_ASSERT_DISABLED(bytes_read);
|
||||
switch (c) {
|
||||
case 'q':
|
||||
LLDB_LOGF(log,
|
||||
|
||||
@ -122,7 +122,7 @@ sigset_t MainLoopPosix::RunImpl::get_sigmask() {
|
||||
sigset_t sigmask;
|
||||
int ret = pthread_sigmask(SIG_SETMASK, nullptr, &sigmask);
|
||||
assert(ret == 0);
|
||||
(void)ret;
|
||||
UNUSED_IF_ASSERT_DISABLED(ret);
|
||||
|
||||
for (const auto &sig : loop.m_signals)
|
||||
sigdelset(&sigmask, sig.first);
|
||||
@ -299,7 +299,7 @@ MainLoopPosix::RegisterSignal(int signo, const Callback &callback,
|
||||
// Even if using kqueue, the signal handler will still be invoked, so it's
|
||||
// important to replace it with our "benign" handler.
|
||||
int ret = sigaction(signo, &new_action, &info.old_action);
|
||||
(void)ret;
|
||||
UNUSED_IF_ASSERT_DISABLED(ret);
|
||||
assert(ret == 0 && "sigaction failed");
|
||||
|
||||
#if HAVE_SYS_EVENT_H
|
||||
@ -346,7 +346,7 @@ void MainLoopPosix::UnregisterSignal(
|
||||
int ret = pthread_sigmask(it->second.was_blocked ? SIG_BLOCK : SIG_UNBLOCK,
|
||||
&set, nullptr);
|
||||
assert(ret == 0);
|
||||
(void)ret;
|
||||
UNUSED_IF_ASSERT_DISABLED(ret);
|
||||
|
||||
#if HAVE_SYS_EVENT_H
|
||||
struct kevent ev;
|
||||
|
||||
@ -30,7 +30,7 @@ MainLoopWindows::~MainLoopWindows() {
|
||||
assert(m_read_fds.empty());
|
||||
BOOL result = WSACloseEvent(m_trigger_event);
|
||||
assert(result == TRUE);
|
||||
(void)result;
|
||||
UNUSED_IF_ASSERT_DISABLED(result);
|
||||
}
|
||||
|
||||
llvm::Expected<size_t> MainLoopWindows::Poll() {
|
||||
@ -39,7 +39,7 @@ llvm::Expected<size_t> MainLoopWindows::Poll() {
|
||||
for (auto &[fd, info] : m_read_fds) {
|
||||
int result = WSAEventSelect(fd, info.event, FD_READ | FD_ACCEPT | FD_CLOSE);
|
||||
assert(result == 0);
|
||||
(void)result;
|
||||
UNUSED_IF_ASSERT_DISABLED(result);
|
||||
|
||||
events.push_back(info.event);
|
||||
}
|
||||
@ -51,7 +51,7 @@ llvm::Expected<size_t> MainLoopWindows::Poll() {
|
||||
for (auto &fd : m_read_fds) {
|
||||
int result = WSAEventSelect(fd.first, WSA_INVALID_EVENT, 0);
|
||||
assert(result == 0);
|
||||
(void)result;
|
||||
UNUSED_IF_ASSERT_DISABLED(result);
|
||||
}
|
||||
|
||||
if (result >= WSA_WAIT_EVENT_0 && result <= WSA_WAIT_EVENT_0 + events.size())
|
||||
@ -99,7 +99,7 @@ void MainLoopWindows::UnregisterReadObject(IOObject::WaitableHandle handle) {
|
||||
assert(it != m_read_fds.end());
|
||||
BOOL result = WSACloseEvent(it->second.event);
|
||||
assert(result == TRUE);
|
||||
(void)result;
|
||||
UNUSED_IF_ASSERT_DISABLED(result);
|
||||
m_read_fds.erase(it);
|
||||
}
|
||||
|
||||
|
||||
@ -161,7 +161,7 @@ AppleObjCRuntimeV1::CreateObjectChecker(std::string name,
|
||||
" \n",
|
||||
name.c_str());
|
||||
assert(strformatsize < (int)sizeof(buf->contents));
|
||||
(void)strformatsize;
|
||||
UNUSED_IF_ASSERT_DISABLED(strformatsize);
|
||||
|
||||
return GetTargetRef().CreateUtilityFunction(buf->contents, std::move(name),
|
||||
eLanguageTypeC, exe_ctx);
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Plugins/ObjectFile/Breakpad/BreakpadRecords.h"
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
@ -119,7 +120,7 @@ static UUID parseModuleId(llvm::Triple::OSType os, llvm::StringRef str) {
|
||||
uint32_t age;
|
||||
bool success = to_integer(age_str, age, 16);
|
||||
assert(success);
|
||||
(void)success;
|
||||
UNUSED_IF_ASSERT_DISABLED(success);
|
||||
data.age = age;
|
||||
|
||||
// On non-windows, the age field should always be zero, so we don't include to
|
||||
|
||||
@ -69,7 +69,7 @@ NativeProcessFreeBSD::Manager::Launch(ProcessLaunchInfo &launch_info,
|
||||
int wstatus;
|
||||
::pid_t wpid = llvm::sys::RetryAfterSignal(-1, ::waitpid, pid, &wstatus, 0);
|
||||
assert(wpid == pid);
|
||||
(void)wpid;
|
||||
UNUSED_IF_ASSERT_DISABLED(wpid);
|
||||
if (!WIFSTOPPED(wstatus)) {
|
||||
LLDB_LOG(log, "Could not sync with inferior process: wstatus={1}",
|
||||
WaitStatus::Decode(wstatus));
|
||||
|
||||
@ -281,7 +281,7 @@ NativeProcessLinux::Manager::Launch(ProcessLaunchInfo &launch_info,
|
||||
int wstatus = 0;
|
||||
::pid_t wpid = llvm::sys::RetryAfterSignal(-1, ::waitpid, pid, &wstatus, 0);
|
||||
assert(wpid == pid);
|
||||
(void)wpid;
|
||||
UNUSED_IF_ASSERT_DISABLED(wpid);
|
||||
if (!WIFSTOPPED(wstatus)) {
|
||||
LLDB_LOG(log, "Could not sync with inferior process: wstatus={1}",
|
||||
WaitStatus::Decode(wstatus));
|
||||
|
||||
@ -1762,7 +1762,7 @@ DWARFASTParserClang::ParseStructureLikeDIE(const SymbolContext &sc,
|
||||
}
|
||||
}
|
||||
assert(tag_decl_kind != -1);
|
||||
(void)tag_decl_kind;
|
||||
UNUSED_IF_ASSERT_DISABLED(tag_decl_kind);
|
||||
bool clang_type_was_created = false;
|
||||
clang_type = CompilerType(
|
||||
m_ast.weak_from_this(),
|
||||
|
||||
@ -216,7 +216,7 @@ void SymbolFileCommon::SetCompileUnitAtIndex(uint32_t idx,
|
||||
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
|
||||
const size_t num_compile_units = GetNumCompileUnits();
|
||||
assert(idx < num_compile_units);
|
||||
(void)num_compile_units;
|
||||
UNUSED_IF_ASSERT_DISABLED(num_compile_units);
|
||||
|
||||
// Fire off an assertion if this compile unit already exists for now. The
|
||||
// partial parsing should take care of only setting the compile unit
|
||||
|
||||
@ -210,7 +210,7 @@ void Log::Warning(const char *format, ...) {
|
||||
void Log::Register(llvm::StringRef name, Channel &channel) {
|
||||
auto iter = g_channel_map->try_emplace(name, channel);
|
||||
assert(iter.second == true);
|
||||
(void)iter;
|
||||
UNUSED_IF_ASSERT_DISABLED(iter);
|
||||
}
|
||||
|
||||
void Log::Unregister(llvm::StringRef name) {
|
||||
|
||||
@ -57,7 +57,7 @@ DAP::DAP()
|
||||
int result = _setmode(fileno(stdout), _O_BINARY);
|
||||
assert(result);
|
||||
result = _setmode(fileno(stdin), _O_BINARY);
|
||||
(void)result;
|
||||
UNUSED_IF_ASSERT_DISABLED(result);
|
||||
assert(result);
|
||||
#endif
|
||||
if (log_file_path)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user