Fixed the forward declaration issue that was present in the DWARF parser after
adding methods to C++ and objective C classes. In order to make methods, we
need the function prototype which means we need the arguments. Parsing these
could cause a circular reference that caused an assertion.
Added a new typedef for the clang opaque types which are just void pointers:
lldb::clang_type_t. This appears in lldb-types.h.
This was fixed by enabling struct, union, class, and enum types to only get
a forward declaration when we make the clang opaque qual type for these
types. When they need to actually be resolved, lldb_private::Type will call
a new function in the SymbolFile protocol to resolve a clang type when it is
not fully defined (clang::TagDecl::getDefinition() returns NULL). This allows
us to be a lot more lazy when parsing clang types and keeps down the amount
of data that gets parsed into the ASTContext for each module.
Getting the clang type from a "lldb_private::Type" object now takes a boolean
that indicates if a forward declaration is ok:
clang_type_t lldb_private::Type::GetClangType (bool forward_decl_is_ok);
So function prototypes that define parameters that are "const T&" can now just
parse the forward declaration for type 'T' and we avoid circular references in
the type system.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115012 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangExpressionDeclMap.cpp b/source/Expression/ClangExpressionDeclMap.cpp
index d1d576f..43c4150 100644
--- a/source/Expression/ClangExpressionDeclMap.cpp
+++ b/source/Expression/ClangExpressionDeclMap.cpp
@@ -709,7 +709,7 @@
if (type->GetASTContext() == var->GetType()->GetClangAST())
{
- if (!ClangASTContext::AreTypesSame(type->GetASTContext(), type->GetOpaqueQualType(), var->GetType()->GetOpaqueClangQualType()))
+ if (!ClangASTContext::AreTypesSame(type->GetASTContext(), type->GetOpaqueQualType(), var->GetType()->GetClangType()))
return NULL;
}
else
@@ -759,7 +759,7 @@
if (!this_type)
return;
- TypeFromUser this_user_type(this_type->GetOpaqueClangQualType(),
+ TypeFromUser this_user_type(this_type->GetClangType(),
this_type->GetClangAST());
m_object_pointer_type = this_user_type;
@@ -836,7 +836,7 @@
if (type.get())
{
- TypeFromUser user_type(type->GetOpaqueClangQualType(),
+ TypeFromUser user_type(type->GetClangType(),
type->GetClangAST());
AddOneType(context, user_type, false);
@@ -866,7 +866,7 @@
return NULL;
}
- void *var_opaque_type = var_type->GetOpaqueClangQualType();
+ void *var_opaque_type = var_type->GetClangType();
if (!var_opaque_type)
{
@@ -1043,7 +1043,7 @@
return;
}
- fun_opaque_type = fun_type->GetOpaqueClangQualType();
+ fun_opaque_type = fun_type->GetClangType();
if (!fun_opaque_type)
{
diff --git a/source/Expression/ClangExpressionVariable.cpp b/source/Expression/ClangExpressionVariable.cpp
index 88e78da..37fc6c2 100644
--- a/source/Expression/ClangExpressionVariable.cpp
+++ b/source/Expression/ClangExpressionVariable.cpp
@@ -97,7 +97,7 @@
if (format == lldb::eFormatDefault)
format = val.GetValueDefaultFormat ();
- void *clang_type = val.GetOpaqueClangQualType ();
+ void *clang_type = val.GetClangType ();
output_stream.Printf("%s = ", m_name.c_str());
diff --git a/source/Expression/ClangFunction.cpp b/source/Expression/ClangFunction.cpp
index 4035479..aaff16d 100644
--- a/source/Expression/ClangFunction.cpp
+++ b/source/Expression/ClangFunction.cpp
@@ -83,7 +83,7 @@
m_JITted (false)
{
m_function_addr = m_function_ptr->GetAddressRange().GetBaseAddress();
- m_function_return_qual_type = m_function_ptr->GetReturnType().GetOpaqueClangQualType();
+ m_function_return_qual_type = m_function_ptr->GetReturnType().GetClangType();
}
//----------------------------------------------------------------------
@@ -153,7 +153,7 @@
else
{
Value *arg_value = m_arg_values.GetValueAtIndex(i);
- void *clang_qual_type = arg_value->GetOpaqueClangQualType ();
+ void *clang_qual_type = arg_value->GetClangType ();
if (clang_qual_type != NULL)
{
type_stdstr = ClangASTContext::GetTypeName(clang_qual_type);
@@ -322,7 +322,7 @@
if (arg_value->GetValueType() == Value::eValueTypeHostAddress &&
arg_value->GetContextType() == Value::eContextTypeOpaqueClangQualType &&
- ClangASTContext::IsPointerType(arg_value->GetOpaqueClangQualType()))
+ ClangASTContext::IsPointerType(arg_value->GetClangType()))
continue;
const Scalar &arg_scalar = arg_value->ResolveValue(&exe_ctx, m_clang_ast_context->getASTContext());
diff --git a/source/Expression/DWARFExpression.cpp b/source/Expression/DWARFExpression.cpp
index a29994e..eef35a1 100644
--- a/source/Expression/DWARFExpression.cpp
+++ b/source/Expression/DWARFExpression.cpp
@@ -2136,7 +2136,7 @@
return false;
}
- void *array_type = array_val.GetOpaqueClangQualType();
+ void *array_type = array_val.GetClangType();
void *member_type;
uint64_t size = 0;
@@ -2214,7 +2214,7 @@
{
case Value::eContextTypeOpaqueClangQualType:
{
- void *clang_type = stack.back().GetOpaqueClangQualType();
+ void *clang_type = stack.back().GetClangType();
if (ClangASTContext::IsAggregateType (clang_type))
{
@@ -2434,7 +2434,7 @@
return false;
}
- void *ptr_type = tmp.GetOpaqueClangQualType();
+ void *ptr_type = tmp.GetClangType();
void *target_type;
if (!ClangASTContext::IsPointerType(ptr_type, &target_type))
@@ -2483,7 +2483,7 @@
Value *proxy = expr_local_variable->CreateProxy();
stack.push_back(*proxy);
delete proxy;
- //stack.back().SetContext (Value::eContextTypeOpaqueClangQualType, expr_local_variable->GetOpaqueClangQualType());
+ //stack.back().SetContext (Value::eContextTypeOpaqueClangQualType, expr_local_variable->GetClangType());
*/
}
break;