summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-07-11 22:46:58 +0000
committerGreg Clayton <gclayton@apple.com>2013-07-11 22:46:58 +0000
commit57ee306789ba68992d537a65b3f107eadd18db2d (patch)
tree2d07b653b2b2dd7dc716b0119b16842861ee9eff /lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
parent37002ad30e7ccee79362e39e0a24c33f87efa993 (diff)
downloadbcm5719-llvm-57ee306789ba68992d537a65b3f107eadd18db2d.tar.gz
bcm5719-llvm-57ee306789ba68992d537a65b3f107eadd18db2d.zip
Huge change to clean up types.
A long time ago we start with clang types that were created by the symbol files and there were many functions in lldb_private::ClangASTContext that helped. Later we create ClangASTType which contains a clang::ASTContext and an opauque QualType, but we didn't switch over to fully using it. There were a lot of places where we would pass around a raw clang_type_t and also pass along a clang::ASTContext separately. This left room for error. This checkin change all type code over to use ClangASTType everywhere and I cleaned up the interfaces quite a bit. Any code that was in ClangASTContext that was type related, was moved over into ClangASTType. All code that used these types was switched over to use all of the new goodness. llvm-svn: 186130
Diffstat (limited to 'lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp')
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp52
1 files changed, 21 insertions, 31 deletions
diff --git a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
index bc63e591cc2..4685c3e759e 100644
--- a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
+++ b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
@@ -318,8 +318,6 @@ ABIMacOSX_arm::GetArgumentValues (Thread &thread,
// For now, assume that the types in the AST values come from the Target's
// scratch AST.
- clang::ASTContext *ast_context = exe_ctx.GetTargetRef().GetScratchClangASTContext()->getASTContext();
-
// Extract the register context so we can read arguments from registers
RegisterContext *reg_ctx = thread.GetRegisterContext().get();
@@ -338,18 +336,18 @@ ABIMacOSX_arm::GetArgumentValues (Thread &thread,
if (!value)
return false;
- void *value_type = value->GetClangType();
- if (value_type)
+ ClangASTType clang_type = value->GetClangType();
+ if (clang_type)
{
bool is_signed = false;
size_t bit_width = 0;
- if (ClangASTContext::IsIntegerType (value_type, is_signed))
+ if (clang_type.IsIntegerType (is_signed))
{
- bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, value_type);
+ bit_width = clang_type.GetBitSize();
}
- else if (ClangASTContext::IsPointerOrReferenceType (value_type))
+ else if (clang_type.IsPointerOrReferenceType ())
{
- bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, value_type);
+ bit_width = clang_type.GetBitSize();
}
else
{
@@ -421,20 +419,20 @@ ABIMacOSX_arm::GetArgumentValues (Thread &thread,
ValueObjectSP
ABIMacOSX_arm::GetReturnValueObjectImpl (Thread &thread,
- lldb_private::ClangASTType &ast_type) const
+ lldb_private::ClangASTType &clang_type) const
{
Value value;
ValueObjectSP return_valobj_sp;
- void *value_type = ast_type.GetOpaqueQualType();
- if (!value_type)
+ if (!clang_type)
return return_valobj_sp;
- clang::ASTContext *ast_context = ast_type.GetASTContext();
+ clang::ASTContext *ast_context = clang_type.GetASTContext();
if (!ast_context)
return return_valobj_sp;
- value.SetContext (Value::eContextTypeClangType, value_type);
+ //value.SetContext (Value::eContextTypeClangType, clang_type.GetOpaqueQualType());
+ value.SetClangType (clang_type);
RegisterContext *reg_ctx = thread.GetRegisterContext().get();
if (!reg_ctx)
@@ -446,9 +444,9 @@ ABIMacOSX_arm::GetReturnValueObjectImpl (Thread &thread,
// when reading data
const RegisterInfo *r0_reg_info = reg_ctx->GetRegisterInfoByName("r0", 0);
- if (ClangASTContext::IsIntegerType (value_type, is_signed))
+ if (clang_type.IsIntegerType (is_signed))
{
- size_t bit_width = ClangASTType::GetClangTypeBitWidth(ast_context, value_type);
+ size_t bit_width = clang_type.GetBitSize();
switch (bit_width)
{
@@ -486,7 +484,7 @@ ABIMacOSX_arm::GetReturnValueObjectImpl (Thread &thread,
break;
}
}
- else if (ClangASTContext::IsPointerType (value_type))
+ else if (clang_type.IsPointerType ())
{
uint32_t ptr = thread.GetRegisterContext()->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX;
value.GetScalar() = ptr;
@@ -499,11 +497,9 @@ ABIMacOSX_arm::GetReturnValueObjectImpl (Thread &thread,
// If we get here, we have a valid Value, so make our ValueObject out of it:
- return_valobj_sp = ValueObjectConstResult::Create(
- thread.GetStackFrameAtIndex(0).get(),
- ast_type.GetASTContext(),
- value,
- ConstString(""));
+ return_valobj_sp = ValueObjectConstResult::Create(thread.GetStackFrameAtIndex(0).get(),
+ value,
+ ConstString(""));
return return_valobj_sp;
}
@@ -517,19 +513,13 @@ ABIMacOSX_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObj
return error;
}
- clang_type_t value_type = new_value_sp->GetClangType();
- if (!value_type)
+ ClangASTType clang_type = new_value_sp->GetClangType();
+ if (!clang_type)
{
error.SetErrorString ("Null clang type for return value.");
return error;
}
- clang::ASTContext *ast_context = new_value_sp->GetClangAST();
- if (!ast_context)
- {
- error.SetErrorString ("Null clang AST for return value.");
- return error;
- }
Thread *thread = frame_sp->GetThread().get();
bool is_signed;
@@ -539,7 +529,7 @@ ABIMacOSX_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObj
RegisterContext *reg_ctx = thread->GetRegisterContext().get();
bool set_it_simple = false;
- if (ClangASTContext::IsIntegerType (value_type, is_signed) || ClangASTContext::IsPointerType(value_type))
+ if (clang_type.IsIntegerType (is_signed) || clang_type.IsPointerType())
{
DataExtractor data;
size_t num_bytes = new_value_sp->GetData(data);
@@ -573,7 +563,7 @@ ABIMacOSX_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObj
error.SetErrorString("We don't support returning longer than 64 bit integer values at present.");
}
}
- else if (ClangASTContext::IsFloatingPointType (value_type, count, is_complex))
+ else if (clang_type.IsFloatingPointType (count, is_complex))
{
if (is_complex)
error.SetErrorString ("We don't support returning complex values at present");
OpenPOWER on IntegriCloud