diff options
author | Chaoren Lin <chaorenl@google.com> | 2015-07-07 17:39:23 +0000 |
---|---|---|
committer | Chaoren Lin <chaorenl@google.com> | 2015-07-07 17:39:23 +0000 |
commit | 57fca019e4a6a331eb336531b78e9e864b9a8c42 (patch) | |
tree | 40470dd3aa7735081635f4f30879baa071de179c /lldb/source/Core/DataExtractor.cpp | |
parent | be8b0ea8542a652207c46fdf9ed412729d248c83 (diff) | |
download | bcm5719-llvm-57fca019e4a6a331eb336531b78e9e864b9a8c42.tar.gz bcm5719-llvm-57fca019e4a6a331eb336531b78e9e864b9a8c42.zip |
Fix APFloat construction from 16 byte APInt.
Reviewers: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D10976
llvm-svn: 241606
Diffstat (limited to 'lldb/source/Core/DataExtractor.cpp')
-rw-r--r-- | lldb/source/Core/DataExtractor.cpp | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/lldb/source/Core/DataExtractor.cpp b/lldb/source/Core/DataExtractor.cpp index b4b43ed9778..8c60a22821e 100644 --- a/lldb/source/Core/DataExtractor.cpp +++ b/lldb/source/Core/DataExtractor.cpp @@ -1830,26 +1830,16 @@ DataExtractor::Dump (Stream *s, } else if (item_bit_size == ast->getTypeSize(ast->LongDoubleTy)) { + auto byte_size = item_byte_size; + const auto &semantics = ast->getFloatTypeSemantics(ast->LongDoubleTy); + if (&semantics == &llvm::APFloat::x87DoubleExtended) + byte_size = 10; + llvm::APInt apint; - switch (target_sp->GetArchitecture().GetMachine()) + if (GetAPInt(*this, &offset, byte_size, apint)) { - case llvm::Triple::x86: - case llvm::Triple::x86_64: - // clang will assert when constructing the apfloat if we use a 16 byte integer value - if (GetAPInt (*this, &offset, 10, apint)) - { - llvm::APFloat apfloat (ast->getFloatTypeSemantics(ast->LongDoubleTy), apint); - apfloat.toString(sv, format_precision, format_max_padding); - } - break; - - default: - if (GetAPInt (*this, &offset, item_byte_size, apint)) - { - llvm::APFloat apfloat (ast->getFloatTypeSemantics(ast->LongDoubleTy), apint); - apfloat.toString(sv, format_precision, format_max_padding); - } - break; + llvm::APFloat apfloat(semantics, apint); + apfloat.toString(sv, format_precision, format_max_padding); } } else if (item_bit_size == ast->getTypeSize(ast->HalfTy)) |