Modified the lldb_private::Type clang type resolving code to handle three

cases when getting the clang type:
- need only a forward declaration
- need a clang type that can be used for layout (members and args/return types)
- need a full clang type

This allows us to partially parse the clang types and be as lazy as possible.
The first case is when we just need to declare a type and we will complete it
later. The forward declaration happens only for class/union/structs and enums.
The layout type allows us to resolve the full clang type _except_ if we have
any modifiers on a pointer or reference (both R and L value). In this case
when we are adding members or function args or return types, we only need to
know how the type will be laid out and we can defer completing the pointee
type until we later need it. The last type means we need a full definition for
the clang type.

Did some renaming of some enumerations to get rid of the old "DC" prefix (which
stands for DebugCore which is no longer around).

Modified the clang namespace support to be almost ready to be fed to the
expression parser. I made a new ClangNamespaceDecl class that can carry around
the AST and the namespace decl so we can copy it into the expression AST. I
modified the symbol vendor and symbol file plug-ins to use this new class.

llvm-svn: 118976
This commit is contained in:
Greg Clayton
2010-11-13 03:52:47 +00:00
parent f01b622902
commit 526e5afb2d
40 changed files with 471 additions and 292 deletions

View File

@@ -658,7 +658,7 @@ ReadRegisterValueAsScalar
else
{
value.SetValueType (Value::eValueTypeScalar);
value.SetContext (Value::eContextTypeDCRegisterInfo, const_cast<RegisterInfo *>(reg_context->GetRegisterInfoAtIndex(native_reg)));
value.SetContext (Value::eContextTypeRegisterInfo, const_cast<RegisterInfo *>(reg_context->GetRegisterInfoAtIndex(native_reg)));
if (reg_context->ReadRegisterValue (native_reg, value.GetScalar()))
return true;
@@ -2121,7 +2121,7 @@ DWARFExpression::Evaluate
return false;
}
if (array_val.GetContextType() != Value::eContextTypeOpaqueClangQualType)
if (array_val.GetContextType() != Value::eContextTypeClangType)
{
if (error_ptr)
error_ptr->SetErrorString("Arrays without Clang types are unhandled at this time.");
@@ -2169,7 +2169,7 @@ DWARFExpression::Evaluate
Value member;
member.SetContext(Value::eContextTypeOpaqueClangQualType, member_type);
member.SetContext(Value::eContextTypeClangType, member_type);
member.SetValueType(array_val.GetValueType());
addr_t array_base = (addr_t)array_val.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
@@ -2212,7 +2212,7 @@ DWARFExpression::Evaluate
StreamString new_value(Stream::eBinary, 4, eByteOrderHost);
switch (context_type)
{
case Value::eContextTypeOpaqueClangQualType:
case Value::eContextTypeClangType:
{
void *clang_type = stack.back().GetClangType();
@@ -2427,7 +2427,7 @@ DWARFExpression::Evaluate
tmp = stack.back();
stack.pop_back();
if (tmp.GetContextType() != Value::eContextTypeOpaqueClangQualType)
if (tmp.GetContextType() != Value::eContextTypeClangType)
{
if (error_ptr)
error_ptr->SetErrorString("Item at top of expression stack must have a Clang type");
@@ -2450,7 +2450,7 @@ DWARFExpression::Evaluate
tmp.ResolveValue(exe_ctx, ast_context);
tmp.SetValueType(value_type);
tmp.SetContext(Value::eContextTypeOpaqueClangQualType, target_type);
tmp.SetContext(Value::eContextTypeClangType, target_type);
stack.push_back(tmp);
}
@@ -2483,7 +2483,7 @@ DWARFExpression::Evaluate
Value *proxy = expr_local_variable->CreateProxy();
stack.push_back(*proxy);
delete proxy;
//stack.back().SetContext (Value::eContextTypeOpaqueClangQualType, expr_local_variable->GetClangType());
//stack.back().SetContext (Value::eContextTypeClangType, expr_local_variable->GetClangType());
*/
}
break;
@@ -2548,7 +2548,7 @@ DWARFExpression::Evaluate
else
{
void *clang_type = (void *)opcodes.GetMaxU64(&offset, sizeof(void*));
stack.back().SetContext (Value::eContextTypeOpaqueClangQualType, clang_type);
stack.back().SetContext (Value::eContextTypeClangType, clang_type);
}
break;
//----------------------------------------------------------------------