Ran the static analyzer on the codebase and found a few things.
llvm-svn: 160338
diff --git a/lldb/source/Plugins/Process/Utility/ARMUtils.h b/lldb/source/Plugins/Process/Utility/ARMUtils.h
index fce066d..76d64e1 100644
--- a/lldb/source/Plugins/Process/Utility/ARMUtils.h
+++ b/lldb/source/Plugins/Process/Utility/ARMUtils.h
@@ -25,10 +25,10 @@
static inline uint32_t DecodeImmShift(const uint32_t type, const uint32_t imm5, ARM_ShifterType &shift_t)
{
- switch (type) {
+ switch (type)
+ {
default:
//assert(0 && "Invalid shift type");
- return UINT32_MAX;
case 0:
shift_t = SRType_LSL;
return imm5;
@@ -50,6 +50,9 @@
return imm5;
}
}
+ shift_t = SRType_Invalid;
+ return UINT32_MAX;
+
}
// A8.6.35 CMP (register) -- Encoding T3
@@ -322,6 +325,7 @@
if (bits(imm12, 11, 10) == 0)
{
switch (bits(imm12, 9, 8)) {
+ default: // Keep static analyzer happy with a default case
case 0:
imm32 = abcdefgh;
break;
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
index d1040d3..e863335 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -184,7 +184,7 @@
UnwindPlan::RowSP active_row;
int cfa_offset = 0;
- int row_register_kind;
+ int row_register_kind = -1;
if (m_full_unwind_plan_sp && m_full_unwind_plan_sp->PlanValidAtAddress (m_current_pc))
{
active_row = m_full_unwind_plan_sp->GetRowForFunctionOffset (m_current_offset);
@@ -507,7 +507,7 @@
UnwindPlan::RowSP active_row;
int cfa_offset = 0;
- int row_register_kind;
+ int row_register_kind = -1;
// Try to get by with just the fast UnwindPlan if possible - the full UnwindPlan may be expensive to get
// (e.g. if we have to parse the entire eh_frame section of an ObjectFile for the first time.)
@@ -670,8 +670,8 @@
const char *has_fast = "";
if (m_fast_unwind_plan_sp)
has_fast = ", and has a fast UnwindPlan";
- log->Printf("%*sFrame %u frame has a fast UnwindPlan",
- m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number);
+ log->Printf("%*sFrame %u frame%s",
+ m_frame_number < 100 ? m_frame_number : 100, "", m_frame_number, has_fast);
}
m_frame_type = eNormalFrame;
return unwind_plan_sp;
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 4fac83d..180c1f3 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1824,13 +1824,13 @@
std::string name;
std::string value;
uint16_t port = 0;
- lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
+ //lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
while (response.GetNameColonValue(name, value))
{
if (name.size() == 4 && name.compare("port") == 0)
port = Args::StringToUInt32(value.c_str(), 0, 0);
- if (name.size() == 3 && name.compare("pid") == 0)
- pid = Args::StringToUInt32(value.c_str(), LLDB_INVALID_PROCESS_ID, 0);
+// if (name.size() == 3 && name.compare("pid") == 0)
+// pid = Args::StringToUInt32(value.c_str(), LLDB_INVALID_PROCESS_ID, 0);
}
return port;
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 06d19e4..6e8b3c4 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -229,8 +229,7 @@
m_register_info.Clear();
uint32_t reg_offset = 0;
uint32_t reg_num = 0;
- StringExtractorGDBRemote::ResponseType response_type;
- for (response_type = StringExtractorGDBRemote::eResponse;
+ for (StringExtractorGDBRemote::ResponseType response_type = StringExtractorGDBRemote::eResponse;
response_type == StringExtractorGDBRemote::eResponse;
++reg_num)
{
@@ -376,7 +375,6 @@
}
else
{
- response_type = StringExtractorGDBRemote::eError;
break;
}
}
@@ -1271,7 +1269,6 @@
uint32_t exc_type = 0;
std::vector<addr_t> exc_data;
addr_t thread_dispatch_qaddr = LLDB_INVALID_ADDRESS;
- uint32_t exc_data_count = 0;
ThreadSP thread_sp;
while (stop_packet.GetNameColonValue(name, value))
@@ -1281,11 +1278,6 @@
// exception type in big endian hex
exc_type = Args::StringToUInt32 (value.c_str(), 0, 16);
}
- else if (name.compare("mecount") == 0)
- {
- // exception count in big endian hex
- exc_data_count = Args::StringToUInt32 (value.c_str(), 0, 16);
- }
else if (name.compare("medata") == 0)
{
// exception data in big endian hex