Audited the expression parser to find uninitialized
pointers. Some of the spots are obviously initialized
later, but it's better just to NULL the pointers out
at initialization to make the code more robust when
exposed to later changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@134670 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangExpressionDeclMap.cpp b/source/Expression/ClangExpressionDeclMap.cpp
index cfe2d00..50f1e88 100644
--- a/source/Expression/ClangExpressionDeclMap.cpp
+++ b/source/Expression/ClangExpressionDeclMap.cpp
@@ -1684,8 +1684,8 @@
if (const NamespaceDecl *namespace_decl = dyn_cast<NamespaceDecl>(context_decl))
{
- Decl *original_decl;
- ASTContext *original_ctx;
+ Decl *original_decl = NULL;
+ ASTContext *original_ctx = NULL;
if (log)
log->Printf("Resolving the containing context's origin...");
@@ -1717,7 +1717,7 @@
DeclContextLookupConstResult original_lookup_result = original_ctx->getExternalSource()->FindExternalVisibleDeclsByName(original_decl_context, context.m_decl_name);
- NamedDecl *const *iter;
+ NamedDecl *const *iter = NULL;
for (iter = original_lookup_result.first;
iter != original_lookup_result.second;
@@ -1866,7 +1866,7 @@
m_struct_vars->m_object_pointer_type = this_user_type;
- void *pointer_target_type;
+ void *pointer_target_type = NULL;
if (!ClangASTContext::IsPointerType(this_user_type.GetOpaqueQualType(),
&pointer_target_type))
@@ -1915,7 +1915,7 @@
m_struct_vars->m_object_pointer_type = self_user_type;
- void *pointer_target_type;
+ void *pointer_target_type = NULL;
if (!ClangASTContext::IsPointerType(self_user_type.GetOpaqueQualType(),
&pointer_target_type))
@@ -2075,7 +2075,7 @@
return NULL;
}
- void *type_to_use;
+ void *type_to_use = NULL;
if (parser_ast_context)
{
@@ -2395,9 +2395,9 @@
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
- NamedDecl *fun_decl;
+ NamedDecl *fun_decl = NULL;
std::auto_ptr<Value> fun_location(new Value);
- const Address *fun_address;
+ const Address *fun_address = NULL;
// only valid for Functions, not for Symbols
void *fun_opaque_type = NULL;