diff options
author | Jim Ingham <jingham@apple.com> | 2011-02-24 21:23:14 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2011-02-24 21:23:14 +0000 |
commit | f6ea93fbab2c5fb6b090d7041ccf39cf991ee013 (patch) | |
tree | 6d47a2e7ac3c116bbb35ff224d257b6df73bce07 /lldb/source/Core/Value.cpp | |
parent | fac373cacb2d0142c2c1e73fd6ea048ca22222bc (diff) | |
download | bcm5719-llvm-f6ea93fbab2c5fb6b090d7041ccf39cf991ee013.tar.gz bcm5719-llvm-f6ea93fbab2c5fb6b090d7041ccf39cf991ee013.zip |
When making a DataExtractor from a Value that's got a ClangType, set the AddressByteSize from the AST Context.
llvm-svn: 126433
Diffstat (limited to 'lldb/source/Core/Value.cpp')
-rw-r--r-- | lldb/source/Core/Value.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp index 723806ffd9d..98aac432231 100644 --- a/lldb/source/Core/Value.cpp +++ b/lldb/source/Core/Value.cpp @@ -524,7 +524,15 @@ Value::GetValueAsData (ExecutionContext *exe_ctx, clang::ASTContext *ast_context case eValueTypeScalar: data.SetByteOrder (lldb::endian::InlHostByteOrder()); - data.SetAddressByteSize(sizeof(void *)); + if (m_context_type == eContextTypeClangType && ast_context) + { + uint32_t ptr_bit_width = ClangASTType::GetClangTypeBitWidth (ast_context, + ClangASTContext::GetVoidPtrType(ast_context, false)); + uint32_t ptr_byte_size = (ptr_bit_width + 7) / 8; + data.SetAddressByteSize (ptr_byte_size); + } + else + data.SetAddressByteSize(sizeof(void *)); if (m_value.GetData (data)) return error; // Success; error.SetErrorStringWithFormat("extracting data from value failed"); |