[Lldb-commits] [PATCH] D10976: Fix APFloat construction from 16 byte APInt.
Chaoren Lin
chaorenl at google.com
Tue Jul 7 10:39:42 PDT 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL241606: Fix APFloat construction from 16 byte APInt. (authored by chaoren).
Changed prior to commit:
http://reviews.llvm.org/D10976?vs=29131&id=29192#toc
Repository:
rL LLVM
http://reviews.llvm.org/D10976
Files:
lldb/trunk/source/Core/DataExtractor.cpp
Index: lldb/trunk/source/Core/DataExtractor.cpp
===================================================================
--- lldb/trunk/source/Core/DataExtractor.cpp
+++ lldb/trunk/source/Core/DataExtractor.cpp
@@ -1830,26 +1830,16 @@
}
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))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10976.29192.patch
Type: text/x-patch
Size: 2515 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150707/dce9591c/attachment.bin>
More information about the lldb-commits
mailing list