Strengthened LLDB's completion of object types.
Now when LLDB reports a variable, it has a
complete type.  Similarly, when it reports
members of a struct, it completes their types.
Also, when it creates the result variable for
an expression, it ensures that variable's type
is complete.

This ensures compliance with Clang's
expectations, preventing potential crashes.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152771 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangASTSource.cpp b/source/Expression/ClangASTSource.cpp
index 593b617..bfe876d 100644
--- a/source/Expression/ClangASTSource.cpp
+++ b/source/Expression/ClangASTSource.cpp
@@ -387,6 +387,17 @@
             
             Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, original_ctx, decl);
             
+            if (FieldDecl *copied_field = dyn_cast<FieldDecl>(copied_decl))
+            {
+                QualType copied_field_type = copied_field->getType();
+                
+                if (const TagType *copied_field_tag_type = copied_field_type->getAs<TagType>())
+                    m_ast_importer->CompleteTagDecl(copied_field_tag_type->getDecl());
+                if (const ObjCObjectType *copied_field_object_type = copied_field_type->getAs<ObjCObjectType>())
+                    if (ObjCInterfaceDecl *copied_field_objc_interface_decl = copied_field_object_type->getInterface())
+                        m_ast_importer->CompleteObjCInterfaceDecl(copied_field_objc_interface_decl);
+            }
+            
             decls.push_back(copied_decl);
         }
     }