summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Language/ObjC
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2016-09-01 18:09:01 +0000
committerEnrico Granata <egranata@apple.com>2016-09-01 18:09:01 +0000
commitdf43d25fd366d96cd7af1ead8938ed0d2394e2fb (patch)
treeb9a9bcb87e3831384559c79976341616170b1a0b /lldb/source/Plugins/Language/ObjC
parent5c7c2307a83665c4861e173a8f4ec4f514c0bbd6 (diff)
downloadbcm5719-llvm-df43d25fd366d96cd7af1ead8938ed0d2394e2fb.tar.gz
bcm5719-llvm-df43d25fd366d96cd7af1ead8938ed0d2394e2fb.zip
Change the formula for tagged NSIndexPath data formatting
Fixes rdar://25192935 llvm-svn: 280389
Diffstat (limited to 'lldb/source/Plugins/Language/ObjC')
-rw-r--r--lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp40
1 files changed, 29 insertions, 11 deletions
diff --git a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
index 0c8a54d76df..0bebaca256b 100644
--- a/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
@@ -26,6 +26,18 @@ using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::formatters;
+static constexpr size_t
+PACKED_INDEX_SHIFT_64(size_t i)
+{
+ return (60 - (13 * (4-i)));
+}
+
+static constexpr size_t
+PACKED_INDEX_SHIFT_32(size_t i)
+{
+ return (32 - (13 * (2-i)));
+}
+
class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd
{
public:
@@ -284,23 +296,29 @@ protected:
std::pair<uint64_t, bool>
_indexAtPositionForInlinePayload(size_t pos)
{
+ static const uint64_t PACKED_INDEX_MASK = ((1 << 13) - 1);
if (m_ptr_size == 8)
{
- switch (pos) {
- case 5: return {((m_indexes >> 51) & 0x1ff),true};
- case 4: return {((m_indexes >> 42) & 0x1ff),true};
- case 3: return {((m_indexes >> 33) & 0x1ff),true};
- case 2: return {((m_indexes >> 24) & 0x1ff),true};
- case 1: return {((m_indexes >> 15) & 0x1ff),true};
- case 0: return {((m_indexes >> 6) & 0x1ff),true};
+ switch (pos)
+ {
+ case 3:
+ case 2:
+ case 1:
+ case 0:
+ return {(m_indexes >> PACKED_INDEX_SHIFT_64(pos)) & PACKED_INDEX_MASK,true};
+ default:
+ return {0,false};
}
}
else
{
- switch (pos) {
- case 2: return {((m_indexes >> 23) & 0x1ff),true};
- case 1: return {((m_indexes >> 14) & 0x1ff),true};
- case 0: return {((m_indexes >> 5) & 0x1ff),true};
+ switch (pos)
+ {
+ case 0:
+ case 1:
+ return {(m_indexes >> PACKED_INDEX_SHIFT_32(pos)) & PACKED_INDEX_MASK,true};
+ default:
+ return {0,false};
}
}
return {0,false};
OpenPOWER on IntegriCloud