diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2016-04-15 09:55:52 +0000 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2016-04-15 09:55:52 +0000 |
commit | 9521ad2a49af44ef74d4ad56e62ed6ac48c8a192 (patch) | |
tree | cc0fc0e8e3caa6169128cae8d7ffdbb68095d2dc /lldb/source/Plugins/ExpressionParser | |
parent | 7ac68ccdc0fe5633839382f7e066d3d43a0f2671 (diff) | |
download | bcm5719-llvm-9521ad2a49af44ef74d4ad56e62ed6ac48c8a192.tar.gz bcm5719-llvm-9521ad2a49af44ef74d4ad56e62ed6ac48c8a192.zip |
Fix usage of APInt.getRawData for big-endian systems
Recommit modified version of r266311 including build bot regression fix.
This differs from the original r266311 by:
- Fixing Scalar::Promote to correctly zero- or sign-extend value depending
on signedness of the *source* type, not the target type.
- Omitting a few stand-alone fixes that were already committed separately.
llvm-svn: 266422
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser')
-rw-r--r-- | lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index 62aa5b7fb88..12ba7e3c2ac 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -1105,7 +1105,13 @@ IRForTarget::MaterializeInitializer (uint8_t *data, Constant *initializer) if (ConstantInt *int_initializer = dyn_cast<ConstantInt>(initializer)) { - memcpy (data, int_initializer->getValue().getRawData(), m_target_data->getTypeStoreSize(initializer_type)); + size_t constant_size = m_target_data->getTypeStoreSize(initializer_type); + lldb_private::Scalar scalar = int_initializer->getValue().zextOrTrunc(llvm::NextPowerOf2(constant_size) * 8); + + lldb_private::Error get_data_error; + if (!scalar.GetAsMemoryData(data, constant_size, lldb_private::endian::InlHostByteOrder(), get_data_error)) + return false; + return true; } else if (ConstantDataArray *array_initializer = dyn_cast<ConstantDataArray>(initializer)) |