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/Symbol/Function.cpp b/source/Symbol/Function.cpp
index 3c108d7..41a708c 100644
--- a/source/Symbol/Function.cpp
+++ b/source/Symbol/Function.cpp
@@ -402,7 +402,7 @@
Type
Function::GetReturnType ()
{
- clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetOpaqueClangQualType()));
+ clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetClangType()));
assert (clang_type->isFunctionType());
clang::FunctionType *function_type = dyn_cast<clang::FunctionType> (clang_type);
clang::QualType fun_return_qualtype = function_type->getResultType();
@@ -421,7 +421,7 @@
int
Function::GetArgumentCount ()
{
- clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetOpaqueClangQualType()));
+ clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetClangType()));
assert (clang_type->isFunctionType());
if (!clang_type->isFunctionProtoType())
return -1;
@@ -436,7 +436,7 @@
const Type
Function::GetArgumentTypeAtIndex (size_t idx)
{
- clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetOpaqueClangQualType()));
+ clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetClangType()));
assert (clang_type->isFunctionType());
if (!clang_type->isFunctionProtoType())
return Type();
@@ -465,7 +465,7 @@
const char *
Function::GetArgumentNameAtIndex (size_t idx)
{
- clang::Type *clang_type = static_cast<clang::QualType *>(GetType()->GetOpaqueClangQualType())->getTypePtr();
+ clang::Type *clang_type = static_cast<clang::QualType *>(GetType()->GetClangType())->getTypePtr();
assert (clang_type->isFunctionType());
if (!clang_type->isFunctionProtoType())
return NULL;
@@ -475,7 +475,7 @@
bool
Function::IsVariadic ()
{
- const clang::Type *clang_type = static_cast<clang::QualType *>(GetType()->GetOpaqueClangQualType())->getTypePtr();
+ const clang::Type *clang_type = static_cast<clang::QualType *>(GetType()->GetClangType())->getTypePtr();
assert (clang_type->isFunctionType());
if (!clang_type->isFunctionProtoType())
return false;