[Lldb-commits] [PATCH] Remove hack about the size of long doubles from DataExtractor
Tamas Berghammer
tberghammer at google.com
Wed Mar 18 08:42:30 PDT 2015
Hi clayborg,
Remove hack about the size of long doubles from DataExtractor
The size of a long double was hardcoded in DataExtractor for x86 and
x86_64 architectures. This CL removes the hard coded values and use the
actual size based on the floating point semantics specified.
This CL depends on D8413
http://reviews.llvm.org/D8417
Files:
source/Core/DataExtractor.cpp
Index: source/Core/DataExtractor.cpp
===================================================================
--- source/Core/DataExtractor.cpp
+++ source/Core/DataExtractor.cpp
@@ -1830,26 +1830,15 @@
}
else if (item_bit_size == ast->getTypeSize(ast->LongDoubleTy))
{
+ const llvm::fltSemantics& float_semantics = ast->getFloatTypeSemantics(ast->LongDoubleTy);
+ unsigned representation_bit_size = llvm::APFloat::getSizeInBits(float_semantics);
+ unsigned representation_byte_size = (representation_bit_size + 7) / 8;
+
llvm::APInt apint;
- switch (target_sp->GetArchitecture().GetMachine())
+ if (GetAPInt (*this, &offset, representation_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 (float_semantics, apint);
+ apfloat.toString(sv, format_precision, format_max_padding);
}
}
else if (item_bit_size == ast->getTypeSize(ast->HalfTy))
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8417.22191.patch
Type: text/x-patch
Size: 2539 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150318/6491fe11/attachment.bin>
More information about the lldb-commits
mailing list