Fixed a few obvious errors pointed out by the static analyzer.

llvm-svn: 181911
This commit is contained in:
Jim Ingham 2013-05-15 18:27:08 +00:00
parent 0f2a6fe613
commit 5c42d8a87c
10 changed files with 20 additions and 7 deletions

View File

@ -188,7 +188,6 @@ SBCommunication::ReadThreadStart ()
if (m_opaque)
success = m_opaque->StartReadThread ();
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBCommunication(%p)::ReadThreadStart () => %i", m_opaque, success);

View File

@ -678,7 +678,7 @@ SBFrame::GetValueForVariablePath (const char *var_path, DynamicValueType use_dyn
ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
StackFrame *frame = exe_ctx.GetFramePtr();
StackFrame *frame = NULL;
Target *target = exe_ctx.GetTargetPtr();
Process *process = exe_ctx.GetProcessPtr();
if (target && process)

View File

@ -1132,6 +1132,9 @@ uint64_t
DataExtractor::GetULEB128 (offset_t *offset_ptr) const
{
const uint8_t *src = (const uint8_t *)PeekData (*offset_ptr, 1);
if (src == NULL)
return 0;
const uint8_t *end = m_end;
if (src < end)
@ -1169,6 +1172,9 @@ int64_t
DataExtractor::GetSLEB128 (offset_t *offset_ptr) const
{
const uint8_t *src = (const uint8_t *)PeekData (*offset_ptr, 1);
if (src == NULL)
return 0;
const uint8_t *end = m_end;
if (src < end)
@ -1213,6 +1219,9 @@ DataExtractor::Skip_LEB128 (offset_t *offset_ptr) const
{
uint32_t bytes_consumed = 0;
const uint8_t *src = (const uint8_t *)PeekData (*offset_ptr, 1);
if (src == NULL)
return 0;
const uint8_t *end = m_end;
if (src < end)

View File

@ -1174,7 +1174,8 @@ ScanFormatDescriptor (const char* var_name_begin,
*val_obj_display = ValueObject::eValueObjectRepresentationStyleType;
break;
default:
log->Printf("ScanFormatDescriptor] %s is an error, leaving the previous value alone", format_name.c_str());
if (log)
log->Printf("ScanFormatDescriptor] %s is an error, leaving the previous value alone", format_name.c_str());
break;
}
}

View File

@ -57,7 +57,7 @@ lldb_private::formatters::NSBundleSummaryProvider (ValueObject& valobj, Stream&
uint64_t offset = 5 * ptr_size;
ClangASTType type(valobj.GetClangAST(),ClangASTContext::GetBuiltInType_objc_id(valobj.GetClangAST()));
ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset, type, true));
valobj_addr = text->GetValueAsUnsigned(0);
StreamString summary_stream;
bool was_nsstring_ok = NSStringSummaryProvider(*text.get(), summary_stream);
if (was_nsstring_ok && summary_stream.GetSize() > 0)

View File

@ -1365,7 +1365,7 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context,
}
}
if (!context.m_found.variable && !namespace_decl)
if (target && !context.m_found.variable && !namespace_decl)
{
// We couldn't find a non-symbol variable for this. Now we'll hunt for a generic
// data symbol, and -- if it is found -- treat it as a variable.

View File

@ -550,7 +550,7 @@ ClangExpressionParser::PrepareForExecution (lldb::addr_t &func_addr,
if (execution_policy == eExecutionPolicyAlways || !can_interpret)
{
if (!process->GetDynamicCheckers() && m_expr.NeedsValidation())
if (m_expr.NeedsValidation() && (process && (!process->GetDynamicCheckers())))
{
DynamicCheckerFunctions *dynamic_checkers = new DynamicCheckerFunctions();

View File

@ -70,7 +70,7 @@ IRMemoryMap::FindSpace (size_t size)
for (int iterations = 0; iterations < 16; ++iterations)
{
lldb::addr_t candidate;
lldb::addr_t candidate = LLDB_INVALID_ADDRESS;
switch (target_sp->GetArchitecture().GetAddressByteSize())
{

View File

@ -980,6 +980,8 @@ FileSpec::EnumerateDirectory
{
// The subdirectory returned Quit, which means to
// stop all directory enumerations at all levels.
if (buf)
free (buf);
return eEnumerateDirectoryResultQuit;
}
break;

View File

@ -696,6 +696,8 @@ Host::SetThreadName (lldb::pid_t pid, lldb::tid_t tid, const char *name)
}
}
return false;
#else
return false;
#endif
}