From: Saleem Abdulrasool Date: Wed, 2 Apr 2014 03:51:35 +0000 (+0000) Subject: sanitise sign comparisons X-Git-Tag: llvmorg-3.5.0-rc1~7773 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3985c8c64680d89a3ab328347e795af0c69c48ea;p=platform%2Fupstream%2Fllvm.git sanitise sign comparisons This is a mechanical change addressing the various sign comparison warnings that are identified by both clang and gcc. This helps cleanup some of the warning spew that occurs during builds. llvm-svn: 205390 --- diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index f1faa13ba981..419c1570170c 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -176,7 +176,8 @@ SBCommandInterpreter::HandleCompletion (const char *current_line, return 0; size_t current_line_size = strlen (current_line); - if (cursor - current_line > current_line_size || last_char - current_line > current_line_size) + if (cursor - current_line > static_cast(current_line_size) || + last_char - current_line > static_cast(current_line_size)) return 0; if (log) diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index ad4e6a83bcf8..e5210418880d 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -1843,7 +1843,7 @@ CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs (Args &args, Target *targe if (breakpoint != NULL) { const size_t num_locations = breakpoint->GetNumLocations(); - if (cur_bp_id.GetLocationID() > num_locations) + if (static_cast(cur_bp_id.GetLocationID()) > num_locations) { StreamString id_str; BreakpointID::GetCanonicalReference (&id_str, diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index 0ef973261508..9143f1d36801 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -204,7 +204,7 @@ protected: if (m_options.relative_frame_offset < 0) { - if (frame_idx >= -m_options.relative_frame_offset) + if (static_cast(frame_idx) >= -m_options.relative_frame_offset) frame_idx += m_options.relative_frame_offset; else { @@ -224,7 +224,7 @@ protected: // I don't want "up 20" where "20" takes you past the top of the stack to produce // an error, but rather to just go to the top. So I have to count the stack here... const uint32_t num_frames = thread->GetStackFrameCount(); - if (num_frames - frame_idx > m_options.relative_frame_offset) + if (static_cast(num_frames - frame_idx) > m_options.relative_frame_offset) frame_idx += m_options.relative_frame_offset; else { diff --git a/lldb/source/Commands/CommandObjectQuit.cpp b/lldb/source/Commands/CommandObjectQuit.cpp index ffe2a9240726..dd0efc61b2d0 100644 --- a/lldb/source/Commands/CommandObjectQuit.cpp +++ b/lldb/source/Commands/CommandObjectQuit.cpp @@ -53,7 +53,7 @@ CommandObjectQuit::ShouldAskForConfirmation (bool& is_a_detach) continue; const TargetList& target_list(debugger_sp->GetTargetList()); for (uint32_t target_idx = 0; - target_idx < target_list.GetNumTargets(); + target_idx < static_cast(target_list.GetNumTargets()); target_idx++) { TargetSP target_sp(target_list.GetTargetAtIndex(target_idx)); diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp index 78a5ad6ca86a..c5338745df37 100644 --- a/lldb/source/Commands/CommandObjectSettings.cpp +++ b/lldb/source/Commands/CommandObjectSettings.cpp @@ -164,7 +164,8 @@ insert-before or insert-after.\n"); const size_t argc = input.GetArgumentCount(); const char *arg = NULL; int setting_var_idx; - for (setting_var_idx = 1; setting_var_idx < argc; ++setting_var_idx) + for (setting_var_idx = 1; setting_var_idx < static_cast(argc); + ++setting_var_idx) { arg = input.GetArgumentAtIndex(setting_var_idx); if (arg && arg[0] != '-') diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp index a8cef0fb1ba5..364d9effb61a 100644 --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -100,7 +100,7 @@ public: static bool WarnOnPotentialUnquotedUnsignedType (Args& command, CommandReturnObject &result) { - for (int idx = 0; idx < command.GetArgumentCount(); idx++) + for (unsigned idx = 0; idx < command.GetArgumentCount(); idx++) { const char* arg = command.GetArgumentAtIndex(idx); if (idx+1 < command.GetArgumentCount()) diff --git a/lldb/source/Core/ConnectionMachPort.cpp b/lldb/source/Core/ConnectionMachPort.cpp index 4a090dbe5ec8..05ada9872b5b 100644 --- a/lldb/source/Core/ConnectionMachPort.cpp +++ b/lldb/source/Core/ConnectionMachPort.cpp @@ -127,7 +127,7 @@ ConnectionMachPort::BootstrapCheckIn (const char *port, Error *error_ptr) { name_t port_name; int len = snprintf(port_name, sizeof(port_name), "%s", port); - if (len < sizeof(port_name)) + if (static_cast(len) < sizeof(port_name)) { kret = ::bootstrap_check_in (bootstrap_port, port_name, @@ -160,7 +160,7 @@ ConnectionMachPort::BootstrapLookup (const char *port, if (port && port[0]) { - if (::snprintf (port_name, sizeof (port_name), "%s", port) >= sizeof (port_name)) + if (static_cast(::snprintf (port_name, sizeof (port_name), "%s", port)) >= sizeof (port_name)) { if (error_ptr) error_ptr->SetErrorString ("port netname is too long"); diff --git a/lldb/source/Core/DataBufferMemoryMap.cpp b/lldb/source/Core/DataBufferMemoryMap.cpp index b385a252b9eb..9dc536b9586a 100644 --- a/lldb/source/Core/DataBufferMemoryMap.cpp +++ b/lldb/source/Core/DataBufferMemoryMap.cpp @@ -240,7 +240,8 @@ DataBufferMemoryMap::MemoryMapFromFileDescriptor (int fd, struct stat stat; if (::fstat(fd, &stat) == 0) { - if (S_ISREG(stat.st_mode) && (stat.st_size > offset)) + if (S_ISREG(stat.st_mode) && + (stat.st_size > static_cast(offset))) { const size_t max_bytes_available = stat.st_size - offset; if (length == SIZE_MAX) diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp index 7c1f5f257b67..738780de0bb9 100644 --- a/lldb/source/Core/IOHandler.cpp +++ b/lldb/source/Core/IOHandler.cpp @@ -1332,7 +1332,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect const size_t max_length = help_delegate_ap->GetMaxLineLength(); Rect bounds = GetBounds(); bounds.Inset(1, 1); - if (max_length + 4 < bounds.size.width) + if (max_length + 4 < static_cast(bounds.size.width)) { bounds.origin.x += (bounds.size.width - max_length + 4)/2; bounds.size.width = max_length + 4; @@ -1347,7 +1347,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect } } - if (num_lines + 2 < bounds.size.height) + if (num_lines + 2 < static_cast(bounds.size.height)) { bounds.origin.y += (bounds.size.height - num_lines + 2)/2; bounds.size.height = num_lines + 2; @@ -1845,9 +1845,9 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect for (size_t i=0; im_name.size()) + if (static_cast(m_max_submenu_name_length) < submenu->m_name.size()) m_max_submenu_name_length = submenu->m_name.size(); - if (m_max_submenu_key_name_length < submenu->m_key_name.size()) + if (static_cast(m_max_submenu_key_name_length) < submenu->m_key_name.size()) m_max_submenu_key_name_length = submenu->m_key_name.size(); } } @@ -1856,9 +1856,9 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect Menu::AddSubmenu (const MenuSP &menu_sp) { menu_sp->m_parent = this; - if (m_max_submenu_name_length < menu_sp->m_name.size()) + if (static_cast(m_max_submenu_name_length) < menu_sp->m_name.size()) m_max_submenu_name_length = menu_sp->m_name.size(); - if (m_max_submenu_key_name_length < menu_sp->m_key_name.size()) + if (static_cast(m_max_submenu_key_name_length) < menu_sp->m_key_name.size()) m_max_submenu_key_name_length = menu_sp->m_key_name.size(); m_submenus.push_back(menu_sp); } @@ -1874,7 +1874,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect if (width > 2) { width -= 2; - for (size_t i=0; i< width; ++i) + for (int i=0; i< width; ++i) window.PutChar(ACS_HLINE); } window.PutChar(ACS_RTEE); @@ -1975,7 +1975,8 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect window.Box(); for (size_t i=0; i(selected_idx)); window.MoveCursor(x, y + i); if (is_selected) { @@ -2014,7 +2015,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect case KEY_DOWN: case KEY_UP: // Show last menu or first menu - if (selected_idx < num_submenus) + if (selected_idx < static_cast(num_submenus)) run_menu_sp = submenus[selected_idx]; else if (!submenus.empty()) run_menu_sp = submenus.front(); @@ -2024,9 +2025,9 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect case KEY_RIGHT: { ++m_selected; - if (m_selected >= num_submenus) + if (m_selected >= static_cast(num_submenus)) m_selected = 0; - if (m_selected < num_submenus) + if (m_selected < static_cast(num_submenus)) run_menu_sp = submenus[m_selected]; else if (!submenus.empty()) run_menu_sp = submenus.front(); @@ -2039,7 +2040,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect --m_selected; if (m_selected < 0) m_selected = num_submenus - 1; - if (m_selected < num_submenus) + if (m_selected < static_cast(num_submenus)) run_menu_sp = submenus[m_selected]; else if (!submenus.empty()) run_menu_sp = submenus.front(); @@ -2093,7 +2094,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect const int start_select = m_selected; while (++m_selected != start_select) { - if (m_selected >= num_submenus) + if (static_cast(m_selected) >= num_submenus) m_selected = 0; if (m_submenus[m_selected]->GetType() == Type::Separator) continue; @@ -2110,7 +2111,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect const int start_select = m_selected; while (--m_selected != start_select) { - if (m_selected < 0) + if (m_selected < static_cast(0)) m_selected = num_submenus - 1; if (m_submenus[m_selected]->GetType() == Type::Separator) continue; @@ -2122,7 +2123,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect break; case KEY_RETURN: - if (selected_idx < num_submenus) + if (static_cast(selected_idx) < num_submenus) { if (submenus[selected_idx]->Action() == MenuActionResult::Quit) return eQuitApplication; @@ -2679,7 +2680,8 @@ public: window.PutChar (ACS_DIAMOND); window.PutChar (ACS_HLINE); } - bool highlight = (selected_row_idx == m_row_idx) && window.IsActive(); + bool highlight = + (selected_row_idx == static_cast(m_row_idx)) && window.IsActive(); if (highlight) window.AttributeOn(A_REVERSE); @@ -2746,11 +2748,11 @@ public: TreeItem * GetItemForRowIndex (uint32_t row_idx) { - if (m_row_idx == row_idx) + if (static_cast(m_row_idx) == row_idx) return this; if (m_children.empty()) return NULL; - if (m_children.back().m_row_idx < row_idx) + if (static_cast(m_children.back().m_row_idx) < row_idx) return NULL; if (IsExpanded()) { @@ -3459,7 +3461,7 @@ public: // Page up key if (m_first_visible_row > 0) { - if (m_first_visible_row > m_max_y) + if (static_cast(m_first_visible_row) > m_max_y) m_first_visible_row -= m_max_y; else m_first_visible_row = 0; @@ -3470,7 +3472,7 @@ public: case '.': case KEY_NPAGE: // Page down key - if (m_num_rows > m_max_y) + if (m_num_rows > static_cast(m_max_y)) { if (m_first_visible_row + m_max_y < m_num_rows) { @@ -3637,7 +3639,7 @@ protected: // Save the row index in each Row structure row.row_idx = m_num_rows; if ((m_num_rows >= m_first_visible_row) && - ((m_num_rows - m_first_visible_row) < NumVisibleRows())) + ((m_num_rows - m_first_visible_row) < static_cast(NumVisibleRows()))) { row.x = m_min_x; row.y = m_num_rows - m_first_visible_row + 1; @@ -4009,7 +4011,7 @@ HelpDialogDelegate::WindowDelegateDraw (Window &window, bool force) int y = 1; const int min_y = y; const int max_y = window_height - 1 - y; - const int num_visible_lines = max_y - min_y + 1; + const size_t num_visible_lines = max_y - min_y + 1; const size_t num_lines = m_text.GetSize(); const char *bottom_message; if (num_lines <= num_visible_lines) @@ -4057,7 +4059,7 @@ HelpDialogDelegate::WindowDelegateHandleChar (Window &window, int key) case ',': if (m_first_visible_line > 0) { - if (m_first_visible_line >= num_visible_lines) + if (static_cast(m_first_visible_line) >= num_visible_lines) m_first_visible_line -= num_visible_lines; else m_first_visible_line = 0; @@ -4068,7 +4070,7 @@ HelpDialogDelegate::WindowDelegateHandleChar (Window &window, int key) if (m_first_visible_line + num_visible_lines < num_lines) { m_first_visible_line += num_visible_lines; - if (m_first_visible_line > num_lines) + if (static_cast(m_first_visible_line) > num_lines) m_first_visible_line = num_lines - num_visible_lines; } break; @@ -4681,7 +4683,7 @@ public: { // Same file, nothing to do, we should either have the // lines or not (source file missing) - if (m_selected_line >= m_first_visible_line) + if (m_selected_line >= static_cast(m_first_visible_line)) { if (m_selected_line >= m_first_visible_line + num_visible_lines) m_first_visible_line = m_selected_line - 10; @@ -4825,7 +4827,7 @@ public: const attr_t selected_highlight_attr = A_REVERSE; const attr_t pc_highlight_attr = COLOR_PAIR(1); - for (int i=0; i= num_disassembly_lines) + if (static_cast(m_first_visible_line) >= num_disassembly_lines) m_first_visible_line = 0; if (pc_idx < num_disassembly_lines) { - if (pc_idx < m_first_visible_line || + if (pc_idx < static_cast(m_first_visible_line) || pc_idx >= m_first_visible_line + num_visible_lines) m_first_visible_line = pc_idx - non_visible_pc_offset; } @@ -5087,7 +5089,7 @@ public: case ',': case KEY_PPAGE: // Page up key - if (m_first_visible_line > num_visible_lines) + if (static_cast(m_first_visible_line) > num_visible_lines) m_first_visible_line -= num_visible_lines; else m_first_visible_line = 0; @@ -5112,7 +5114,7 @@ public: if (m_selected_line > 0) { m_selected_line--; - if (m_first_visible_line > m_selected_line) + if (static_cast(m_first_visible_line) > m_selected_line) m_first_visible_line = m_selected_line; } return eKeyHandled; diff --git a/lldb/source/Core/Opcode.cpp b/lldb/source/Core/Opcode.cpp index 2bf7f5eae9b0..73f5f85923c6 100644 --- a/lldb/source/Core/Opcode.cpp +++ b/lldb/source/Core/Opcode.cpp @@ -63,7 +63,7 @@ Opcode::Dump (Stream *s, uint32_t min_byte_width) // Add spaces to make sure bytes dispay comes out even in case opcodes // aren't all the same size - if (bytes_written < min_byte_width) + if (static_cast(bytes_written) < min_byte_width) bytes_written = s->Printf ("%*s", min_byte_width - bytes_written, ""); return bytes_written; } diff --git a/lldb/source/DataFormatters/CF.cpp b/lldb/source/DataFormatters/CF.cpp index a4b7a1235ffa..342ced78effe 100644 --- a/lldb/source/DataFormatters/CF.cpp +++ b/lldb/source/DataFormatters/CF.cpp @@ -160,7 +160,7 @@ lldb_private::formatters::CFBitVectorSummaryProvider (ValueObject& valobj, Strea if (error.Fail() || num_bytes == 0) return false; uint8_t *bytes = buffer_sp->GetBytes(); - for (int byte_idx = 0; byte_idx < num_bytes-1; byte_idx++) + for (uint64_t byte_idx = 0; byte_idx < num_bytes-1; byte_idx++) { uint8_t byte = bytes[byte_idx]; bool bit0 = (byte & 1) == 1; diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp index 5552cb3d5d76..6b5748b52ce9 100644 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -642,7 +642,7 @@ IRInterpreter::Interpret (llvm::Module &module, ai != ae; ++ai, ++arg_index) { - if (args.size() < arg_index) + if (args.size() < static_cast(arg_index)) { error.SetErrorString ("Not enough arguments passed in to function"); return false; diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 624ff4205d62..2886644c5ebd 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -1786,8 +1786,8 @@ Host::LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_i cpu_type_t cpu = arch_spec.GetMachOCPUType(); cpu_type_t sub = arch_spec.GetMachOCPUSubType(); if (cpu != 0 && - cpu != UINT32_MAX && - cpu != LLDB_INVALID_CPUTYPE && + cpu != static_cast(UINT32_MAX) && + cpu != static_cast(LLDB_INVALID_CPUTYPE) && !(cpu == 0x01000007 && sub == 8)) // If haswell is specified, don't try to set the CPU type or we will fail { size_t ocount = 0; @@ -2306,7 +2306,7 @@ Host::Readlink (const char *path, char *buf, size_t buf_len) ssize_t count = ::readlink(path, buf, buf_len); if (count < 0) error.SetErrorToErrno(); - else if (count < (buf_len-1)) + else if (static_cast(count) < (buf_len-1)) buf[count] = '\0'; // Success else error.SetErrorString("'buf' buffer is too small to contain link contents"); @@ -2391,7 +2391,8 @@ Host::WriteFile (lldb::user_id_t fd, uint64_t offset, const void* src, uint64_t error.SetErrorString ("invalid host backing file"); return UINT64_MAX; } - if (file_sp->SeekFromStart(offset, &error) != offset || error.Fail()) + if (static_cast(file_sp->SeekFromStart(offset, &error)) != offset || + error.Fail()) return UINT64_MAX; size_t bytes_written = src_len; error = file_sp->Write(src, bytes_written); @@ -2421,7 +2422,8 @@ Host::ReadFile (lldb::user_id_t fd, uint64_t offset, void* dst, uint64_t dst_len error.SetErrorString ("invalid host backing file"); return UINT64_MAX; } - if (file_sp->SeekFromStart(offset, &error) != offset || error.Fail()) + if (static_cast(file_sp->SeekFromStart(offset, &error)) != offset || + error.Fail()) return UINT64_MAX; size_t bytes_read = dst_len; error = file_sp->Read(dst ,bytes_read); diff --git a/lldb/source/Host/common/Terminal.cpp b/lldb/source/Host/common/Terminal.cpp index f63c468bb92c..811d712ea0de 100644 --- a/lldb/source/Host/common/Terminal.cpp +++ b/lldb/source/Host/common/Terminal.cpp @@ -250,7 +250,7 @@ TerminalState::TTYStateIsValid() const bool TerminalState::ProcessGroupIsValid() const { - return m_process_group != -1; + return static_cast(m_process_group) != -1; } //------------------------------------------------------------------ diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp index 441a431fe0a5..3c05243f92a8 100644 --- a/lldb/source/Host/linux/Host.cpp +++ b/lldb/source/Host/linux/Host.cpp @@ -520,7 +520,7 @@ Host::GetDistributionId () "/usr/bin/lsb_release" }; - for (int exe_index = 0; + for (size_t exe_index = 0; exe_index < sizeof (exe_paths) / sizeof (exe_paths[0]); ++exe_index) { diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm index b9d2419dcdfd..4817f412e0bd 100644 --- a/lldb/source/Host/macosx/Host.mm +++ b/lldb/source/Host/macosx/Host.mm @@ -1171,7 +1171,7 @@ GetMacOSXProcessArgs (const ProcessInstanceInfoMatch *match_info_ptr, } // Now extract all arguments Args &proc_args = process_info.GetArguments(); - for (int i=0; i(argc); ++i) { cstr = data.GetCStr(&offset); if (cstr) @@ -1248,7 +1248,7 @@ Host::FindProcesses (const ProcessInstanceInfoMatch &match_info, ProcessInstance bool all_users = match_info.GetMatchAllUsers(); const lldb::pid_t our_pid = getpid(); const uid_t our_uid = getuid(); - for (int i = 0; i < actual_pid_count; i++) + for (size_t i = 0; i < actual_pid_count; i++) { const struct kinfo_proc &kinfo = kinfos[i]; @@ -1263,7 +1263,7 @@ Host::FindProcesses (const ProcessInstanceInfoMatch &match_info, ProcessInstance kinfo_user_matches = true; if (kinfo_user_matches == false || // Make sure the user is acceptable - kinfo.kp_proc.p_pid == our_pid || // Skip this process + static_cast(kinfo.kp_proc.p_pid) == our_pid || // Skip this process kinfo.kp_proc.p_pid == 0 || // Skip kernel (kernel pid is zero) kinfo.kp_proc.p_stat == SZOMB || // Zombies are bad, they like brains... kinfo.kp_proc.p_flag & P_TRACED || // Being debugged? @@ -1327,9 +1327,9 @@ PackageXPCArguments (xpc_object_t message, const char *prefix, const Args& args) memset(buf, 0, 50); sprintf(buf, "%sCount", prefix); xpc_dictionary_set_int64(message, buf, count); - for (int i=0; i(OptionParser::GetOptionIndex()) < dummy_vec.size() - 1 && (strcmp (dummy_vec[OptionParser::GetOptionIndex()-1], "--") == 0)) { dash_dash_pos = OptionParser::GetOptionIndex() - 1; - if (OptionParser::GetOptionIndex() - 1 == cursor_index) + if (static_cast(OptionParser::GetOptionIndex() - 1) == cursor_index) { option_element_vector.push_back (OptionArgElement (OptionArgElement::eBareDoubleDash, OptionParser::GetOptionIndex() - 1, OptionArgElement::eBareDoubleDash)); @@ -1630,7 +1630,7 @@ Args::ParseArgsForCompletion // the option_element_vector, but only if it is not after the "--". But it turns out that OptionParser::Parse just ignores // an isolated "-". So we have to look it up by hand here. We only care if it is AT the cursor position. - if ((dash_dash_pos == -1 || cursor_index < dash_dash_pos) + if ((static_cast(dash_dash_pos) == -1 || cursor_index < dash_dash_pos) && strcmp (GetArgumentAtIndex(cursor_index), "-") == 0) { option_element_vector.push_back (OptionArgElement (OptionArgElement::eBareDash, cursor_index, diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 18f108bb58ae..6dfb2ca72801 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1363,7 +1363,7 @@ CommandInterpreter::BuildAliasResult (const char *alias_name, int index = GetOptionArgumentPosition (value.c_str()); if (index == 0) result_str.Printf ("%s", value.c_str()); - else if (index >= cmd_args.GetArgumentCount()) + else if (static_cast(index) >= cmd_args.GetArgumentCount()) { result.AppendErrorWithFormat @@ -2254,7 +2254,7 @@ CommandInterpreter::BuildAliasCommandArgs (CommandObject *alias_cmd_obj, } } - else if (index >= cmd_args.GetArgumentCount()) + else if (static_cast(index) >= cmd_args.GetArgumentCount()) { result.AppendErrorWithFormat ("Not enough arguments provided; you need at least %d arguments to use this alias.\n", diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index c6995366c87a..0dba2a3283fb 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -477,7 +477,7 @@ CommandObject::GetNumArgumentEntries () CommandObject::CommandArgumentEntry * CommandObject::GetArgumentEntryAtIndex (int idx) { - if (idx < m_arguments.size()) + if (static_cast(idx) < m_arguments.size()) return &(m_arguments[idx]); return NULL; diff --git a/lldb/source/Interpreter/OptionValueArray.cpp b/lldb/source/Interpreter/OptionValueArray.cpp index 9a015580bd6c..ee70a0ac1fc4 100644 --- a/lldb/source/Interpreter/OptionValueArray.cpp +++ b/lldb/source/Interpreter/OptionValueArray.cpp @@ -222,7 +222,8 @@ OptionValueArray::SetArgs (const Args &args, VarSetOperationType op) size_t i; for (i=0; i= size) { all_indexes_valid = false; diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp index c6c66d8ac650..ce987576a97a 100644 --- a/lldb/source/Interpreter/Options.cpp +++ b/lldb/source/Interpreter/Options.cpp @@ -344,7 +344,7 @@ Options::OutputFormattedUsageText // Will it all fit on one line? - if ((len + strm.GetIndentLevel()) < output_max_columns) + if (static_cast(len + strm.GetIndentLevel()) < output_max_columns) { // Output it as a single line. strm.Indent (text); diff --git a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp index 1b6c7ef55ae7..a7f6ce64d67c 100644 --- a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp +++ b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp @@ -237,10 +237,10 @@ ABIMacOSX_arm64::PrepareTrivialCall (Thread &thread, { RegisterContext *reg_ctx = thread.GetRegisterContext().get(); if (!reg_ctx) - return false; - + return false; + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - + if (log) { StreamString s; @@ -249,8 +249,8 @@ ABIMacOSX_arm64::PrepareTrivialCall (Thread &thread, (uint64_t)sp, (uint64_t)func_addr, (uint64_t)return_addr); - - for (int i = 0; i < args.size(); ++i) + + for (size_t i = 0; i < args.size(); ++i) s.Printf (", arg%d = 0x%" PRIx64, i + 1, args[i]); s.PutCString (")"); log->PutCString(s.GetString().c_str()); @@ -259,12 +259,12 @@ ABIMacOSX_arm64::PrepareTrivialCall (Thread &thread, const uint32_t pc_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC); const uint32_t sp_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP); const uint32_t ra_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA); - + // x0 - x7 contain first 8 simple args if (args.size() > 8) // TODO handle more than 6 arguments return false; - - for (int i = 0; i < args.size(); ++i) + + for (size_t i = 0; i < args.size(); ++i) { const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i); if (log) @@ -276,15 +276,15 @@ ABIMacOSX_arm64::PrepareTrivialCall (Thread &thread, // Set "lr" to the return address if (!reg_ctx->WriteRegisterFromUnsigned (reg_ctx->GetRegisterInfoAtIndex (ra_reg_num), return_addr)) return false; - + // Set "sp" to the requested value if (!reg_ctx->WriteRegisterFromUnsigned (reg_ctx->GetRegisterInfoAtIndex (sp_reg_num), sp)) return false; - + // Set "pc" to the address requested if (!reg_ctx->WriteRegisterFromUnsigned (reg_ctx->GetRegisterInfoAtIndex (pc_reg_num), func_addr)) return false; - + return true; } diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp index 763a00aa9a7f..1316da48eedd 100644 --- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp +++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp @@ -316,8 +316,8 @@ ABISysV_x86_64::PrepareTrivialCall (Thread &thread, (uint64_t)func_addr, (uint64_t)return_addr); - for (int i = 0; i < args.size(); ++i) - s.Printf (", arg%d = 0x%" PRIx64, i + 1, args[i]); + for (size_t i = 0; i < args.size(); ++i) + s.Printf (", arg%zd = 0x%" PRIx64, i + 1, args[i]); s.PutCString (")"); log->PutCString(s.GetString().c_str()); } @@ -331,11 +331,11 @@ ABISysV_x86_64::PrepareTrivialCall (Thread &thread, if (args.size() > 6) // TODO handle more than 6 arguments return false; - for (int i = 0; i < args.size(); ++i) + for (size_t i = 0; i < args.size(); ++i) { reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i); if (log) - log->Printf("About to write arg%d (0x%" PRIx64 ") into %s", i + 1, args[i], reg_info->name); + log->Printf("About to write arg%zd (0x%" PRIx64 ") into %s", i + 1, args[i], reg_info->name); if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i])) return false; } diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index f475dbd773db..2b9b34685463 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -635,11 +635,11 @@ DynamicLoaderMacOSXDYLD::NotifyBreakpointHit (void *baton, if (abi->GetArgumentValues (exe_ctx.GetThreadRef(), argument_values)) { uint32_t dyld_mode = argument_values.GetValueAtIndex(0)->GetScalar().UInt (-1); - if (dyld_mode != -1) + if (dyld_mode != static_cast(-1)) { // Okay the mode was right, now get the number of elements, and the array of new elements... uint32_t image_infos_count = argument_values.GetValueAtIndex(1)->GetScalar().UInt (-1); - if (image_infos_count != -1) + if (image_infos_count != static_cast(-1)) { // Got the number added, now go through the array of added elements, putting out the mach header // address, and adding the image. diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp index 530e11af22c1..ec0f093e6ad2 100644 --- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp +++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp @@ -329,7 +329,7 @@ ObjectFileJIT::ReadSectionData (const lldb_private::Section *section, size_t dst_len) const { lldb::offset_t file_size = section->GetFileSize(); - if (section_offset < file_size) + if (section_offset < static_cast(file_size)) { uint64_t src_len = file_size - section_offset; if (src_len > dst_len) diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 814df8897a44..84e3dddd16f0 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -4646,7 +4646,7 @@ ObjectFileMachO::GetProcessSharedCacheUUID (Process *process) Error err; uint32_t version_or_magic = process->ReadUnsignedIntegerFromMemory (all_image_infos, 4, -1, err); - if (version_or_magic != -1 + if (version_or_magic != static_cast(-1) && version_or_magic != MH_MAGIC && version_or_magic != MH_CIGAM && version_or_magic != MH_MAGIC_64 diff --git a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp index 198a1eb595c1..8583f67ab0e7 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp +++ b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp @@ -1142,7 +1142,7 @@ ProcessMonitor::Launch(LaunchArgs *args) if (envp == NULL || envp[0] == NULL) envp = const_cast(environ); - if ((pid = terminal.Fork(err_str, err_len)) == -1) + if ((pid = terminal.Fork(err_str, err_len)) == static_cast(-1)) { args->m_error.SetErrorToGenericError(); args->m_error.SetErrorString("Process fork failed."); @@ -1203,7 +1203,7 @@ ProcessMonitor::Launch(LaunchArgs *args) } // Wait for the child process to to trap on its call to execve. - pid_t wpid; + lldb::pid_t wpid; int status; if ((wpid = waitpid(pid, &status, 0)) < 0) { @@ -1746,7 +1746,7 @@ ProcessMonitor::StopThread(lldb::tid_t tid) if (log) log->Printf ("ProcessMonitor::%s(bp) waitpid, pid = %" PRIu64 ", status = %d", __FUNCTION__, wait_pid, status); - if (wait_pid == -1) + if (wait_pid == static_cast(-1)) { // If we got interrupted by a signal (in our process, not the // inferior) try again. diff --git a/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp b/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp index b7867c385e83..744d7ada9c8c 100644 --- a/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp +++ b/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp @@ -323,7 +323,7 @@ DynamicRegisterInfo::SetRegisterInfo (const lldb_private::PythonDictionary &dict reg_info.encoding = (Encoding)reg_info_dict.GetItemForKeyAsInteger (encoding_pystr, eEncodingUint); const int64_t set = reg_info_dict.GetItemForKeyAsInteger(set_pystr, -1); - if (set >= m_sets.size()) + if (static_cast(set) >= m_sets.size()) { Clear(); return 0; @@ -379,7 +379,7 @@ DynamicRegisterInfo::SetRegisterInfo (const lldb_private::PythonDictionary &dict if (invalidate_reg_num) { const int64_t r = invalidate_reg_num.GetInteger(); - if (r != UINT64_MAX) + if (r != static_cast(UINT64_MAX)) m_invalidate_regs_map[i].push_back(r); else printf("error: 'invalidate-regs' list value wasn't a valid integer\n"); diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp index 5db08e5c26de..37fd4f489552 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp @@ -347,7 +347,7 @@ bool UnwindLLDB::SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation ®loc, uint32_t starting_frame_num, bool pc_reg) { int64_t frame_num = starting_frame_num; - if (frame_num >= m_frames.size()) + if (static_cast(frame_num) >= m_frames.size()) return false; // Never interrogate more than one level while looking for the saved pc value. If the value diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index f436799a86a1..706d67ea961a 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -3106,7 +3106,7 @@ GDBRemoteCommunicationClient::GetFilePermissions(const char *path, uint32_t &fil else { const uint32_t mode = response.GetS32(-1); - if (mode == -1) + if (static_cast(mode) == -1) { if (response.GetChar() == ',') { diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index 9e5b0d79e101..acaf825d18b5 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -689,23 +689,23 @@ GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data size_including_slice_registers += reg_info->byte_size; if (reg_info->value_regs == NULL) size_not_including_slice_registers += reg_info->byte_size; - if (reg_info->byte_offset >= size_by_highest_offset) + if (static_cast(reg_info->byte_offset) >= size_by_highest_offset) size_by_highest_offset = reg_info->byte_offset + reg_info->byte_size; } bool use_byte_offset_into_buffer; - if (size_by_highest_offset == restore_data.GetByteSize()) + if (static_cast(size_by_highest_offset) == restore_data.GetByteSize()) { // The size of the packet agrees with the highest offset: + size in the register file use_byte_offset_into_buffer = true; } - else if (size_not_including_slice_registers == restore_data.GetByteSize()) + else if (static_cast(size_not_including_slice_registers) == restore_data.GetByteSize()) { // The size of the packet is the same as concenating all of the registers sequentially, // skipping the slice registers use_byte_offset_into_buffer = true; } - else if (size_including_slice_registers == restore_data.GetByteSize()) + else if (static_cast(size_including_slice_registers) == restore_data.GetByteSize()) { // The slice registers are present in the packet (when they shouldn't be). // Don't try to use the RegisterInfo byte_offset into the restore_data, it will diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp index b0375d1ceb37..f7eb613034dd 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp @@ -795,7 +795,7 @@ DWARFDebugLine::ParseStatementTable // as a multiple of LEB128 operands for each opcode. { uint8_t i; - assert (opcode - 1 < prologue->standard_opcode_lengths.size()); + assert (static_cast(opcode - 1) < prologue->standard_opcode_lengths.size()); const uint8_t opcode_length = prologue->standard_opcode_lengths[opcode - 1]; for (i=0; i(i) < pending_items_pointer.count) { offset = start_of_array_offset + (i * item_size); ItemRefAndCodeAddress item; @@ -634,7 +635,8 @@ SystemRuntimeMacOSX::GetPendingItemRefsForQueue (lldb::addr_t queue) { offset = 0; pending_item_refs.new_style = false; - while (offset < pending_items_pointer.items_buffer_size && i < pending_items_pointer.count) + while (offset < pending_items_pointer.items_buffer_size && + static_cast(i) < pending_items_pointer.count) { ItemRefAndCodeAddress item; item.item_ref = extractor.GetPointer (&offset); diff --git a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp index 1768798f71d4..ff7f758cf95d 100644 --- a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp +++ b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp @@ -479,7 +479,8 @@ AssemblyParse_x86::instruction_length (Address addr, int &length) const bool prefer_file_cache = true; Error error; Target *target = m_exe_ctx.GetTargetPtr(); - if (target->ReadMemory (addr, prefer_file_cache, opcode_data.data(), max_op_byte_size, error) == -1) + if (target->ReadMemory (addr, prefer_file_cache, opcode_data.data(), + max_op_byte_size, error) == static_cast(-1)) { return false; } @@ -552,7 +553,8 @@ AssemblyParse_x86::get_non_call_site_unwind_plan (UnwindPlan &unwind_plan) // An unrecognized/junk instruction break; } - if (target->ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes, insn_len, error) == -1) + if (target->ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes, + insn_len, error) == static_cast(-1)) { // Error reading the instruction out of the file, stop scanning break; @@ -600,7 +602,7 @@ AssemblyParse_x86::get_non_call_site_unwind_plan (UnwindPlan &unwind_plan) bool need_to_push_row = false; // the PUSH instruction has moved the stack pointer - if the CFA is set in terms of the stack pointer, // we need to add a new row of instructions. - if (row->GetCFARegister() == m_lldb_sp_regnum) + if (row->GetCFARegister() == static_cast(m_lldb_sp_regnum)) { need_to_push_row = true; row->SetCFAOffset (current_sp_bytes_offset_from_cfa); @@ -645,7 +647,7 @@ AssemblyParse_x86::get_non_call_site_unwind_plan (UnwindPlan &unwind_plan) if (sub_rsp_pattern_p (stack_offset)) { current_sp_bytes_offset_from_cfa += stack_offset; - if (row->GetCFARegister() == m_lldb_sp_regnum) + if (row->GetCFARegister() == static_cast(m_lldb_sp_regnum)) { row->SetOffset (current_func_text_offset + insn_len); row->SetCFAOffset (current_sp_bytes_offset_from_cfa); @@ -699,7 +701,8 @@ loopnext: uint8_t bytebuf[7]; Address last_seven_bytes(end_of_fun); last_seven_bytes.SetOffset (last_seven_bytes.GetOffset() - 7); - if (target->ReadMemory (last_seven_bytes, prefer_file_cache, bytebuf, 7, error) != -1) + if (target->ReadMemory (last_seven_bytes, prefer_file_cache, bytebuf, 7, + error) != static_cast(-1)) { if (bytebuf[5] == 0x5d && bytebuf[6] == 0xc3) // mov, ret { @@ -715,7 +718,8 @@ loopnext: uint8_t bytebuf[2]; Address last_two_bytes(end_of_fun); last_two_bytes.SetOffset (last_two_bytes.GetOffset() - 2); - if (target->ReadMemory (last_two_bytes, prefer_file_cache, bytebuf, 2, error) != -1) + if (target->ReadMemory (last_two_bytes, prefer_file_cache, bytebuf, 2, + error) != static_cast(-1)) { if (bytebuf[0] == 0x5d && bytebuf[1] == 0xc3) // mov, ret { @@ -776,7 +780,8 @@ AssemblyParse_x86::get_fast_unwind_plan (AddressRange& func, UnwindPlan &unwind_ uint8_t bytebuf[4]; Error error; const bool prefer_file_cache = true; - if (target->ReadMemory (func.GetBaseAddress(), prefer_file_cache, bytebuf, sizeof (bytebuf), error) == -1) + if (target->ReadMemory (func.GetBaseAddress(), prefer_file_cache, bytebuf, + sizeof (bytebuf), error) == static_cast(-1)) return false; uint8_t i386_prologue[] = {0x55, 0x89, 0xe5}; @@ -859,7 +864,8 @@ AssemblyParse_x86::find_first_non_prologue_insn (Address &address) // An error parsing the instruction, i.e. probably data/garbage - stop scanning break; } - if (target->ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes, insn_len, error) == -1) + if (target->ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes, + insn_len, error) == static_cast(-1)) { // Error reading the instruction out of the file, stop scanning break; diff --git a/lldb/source/Symbol/ClangASTType.cpp b/lldb/source/Symbol/ClangASTType.cpp index aff032f4cf2e..cbaf36c89c55 100644 --- a/lldb/source/Symbol/ClangASTType.cpp +++ b/lldb/source/Symbol/ClangASTType.cpp @@ -3268,7 +3268,7 @@ ClangASTType::GetChildClangTypeAtIndex (ExecutionContext *exe_ctx, // Setting this to UINT32_MAX to make sure we don't compute it twice... bit_offset = UINT32_MAX; - if (child_byte_offset == LLDB_INVALID_IVAR_OFFSET) + if (child_byte_offset == static_cast(LLDB_INVALID_IVAR_OFFSET)) { bit_offset = interface_layout.getFieldOffset (child_idx - superclass_idx); child_byte_offset = bit_offset / 8; diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index 931433540c68..c3294c943756 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -486,7 +486,7 @@ ObjectFile::ReadSectionData (const Section *section, off_t section_offset, void else { const uint64_t section_file_size = section->GetFileSize(); - if (section_offset < section_file_size) + if (section_offset < static_cast(section_file_size)) { const uint64_t section_bytes_left = section_file_size - section_offset; uint64_t section_dst_len = dst_len; diff --git a/lldb/source/Symbol/UnwindPlan.cpp b/lldb/source/Symbol/UnwindPlan.cpp index 7b361e7d2eb9..470a3d50a632 100644 --- a/lldb/source/Symbol/UnwindPlan.cpp +++ b/lldb/source/Symbol/UnwindPlan.cpp @@ -326,7 +326,7 @@ UnwindPlan::GetRowForFunctionOffset (int offset) const collection::const_iterator pos, end = m_row_list.end(); for (pos = m_row_list.begin(); pos != end; ++pos) { - if ((*pos)->GetOffset() <= offset) + if ((*pos)->GetOffset() <= static_cast(offset)) row = *pos; else break; diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp index db23a0b27130..0d70d03a4767 100644 --- a/lldb/source/Target/PathMappingList.cpp +++ b/lldb/source/Target/PathMappingList.cpp @@ -134,7 +134,7 @@ PathMappingList::Replace (const ConstString &path, bool PathMappingList::Remove (off_t index, bool notify) { - if (index >= m_pairs.size()) + if (static_cast(index) >= m_pairs.size()) return false; ++m_mod_id; @@ -161,7 +161,7 @@ PathMappingList::Dump (Stream *s, int pair_index) } else { - if (pair_index < numPairs) + if (static_cast(pair_index) < numPairs) s->Printf("%s -> %s", m_pairs[pair_index].first.GetCString(), m_pairs[pair_index].second.GetCString()); } diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp index a936a57d048d..0ba30bed35f2 100644 --- a/lldb/source/Target/StackFrame.cpp +++ b/lldb/source/Target/StackFrame.cpp @@ -861,7 +861,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, valobj_sp->GetTypeName().AsCString(""), var_expr_path_strm.GetString().c_str()); } - else if (child_index >= synthetic->GetNumChildren() /* synthetic does not have that many values */) + else if (static_cast(child_index) >= synthetic->GetNumChildren() /* synthetic does not have that many values */) { valobj_sp->GetExpressionPath (var_expr_path_strm, false); error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"", @@ -937,7 +937,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, valobj_sp->GetTypeName().AsCString(""), var_expr_path_strm.GetString().c_str()); } - else if (child_index >= synthetic->GetNumChildren() /* synthetic does not have that many values */) + else if (static_cast(child_index) >= synthetic->GetNumChildren() /* synthetic does not have that many values */) { valobj_sp->GetExpressionPath (var_expr_path_strm, false); error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"", diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 1d7da985fbac..0f82617acf68 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -2121,7 +2121,8 @@ Thread::IsStillAtLastBreakpointHit () { lldb::addr_t pc = reg_ctx_sp->GetPC(); BreakpointSiteSP bp_site_sp = GetProcess()->GetBreakpointSiteList().FindByAddress(pc); - if (bp_site_sp && value == bp_site_sp->GetID()) + if (bp_site_sp && + static_cast(value) == bp_site_sp->GetID()) return true; } } diff --git a/lldb/source/lldb.cpp b/lldb/source/lldb.cpp index 30f446d5bb51..23a70947e7fd 100644 --- a/lldb/source/lldb.cpp +++ b/lldb/source/lldb.cpp @@ -297,7 +297,8 @@ lldb_private::GetVersion () size_t version_len = sizeof(g_version_string); - if (newline_loc && (newline_loc - version_string < version_len)) + if (newline_loc && + (newline_loc - version_string < static_cast(version_len))) version_len = newline_loc - version_string; ::strncpy(g_version_string, version_string, version_len);