Dumpers: Fix std::string for clang >= 15

libc++ has changed the layout of std::string again.
(see https://reviews.llvm.org/D128285)

This patch adds checks to differentiate between the two versions.

Fixes: QTCREATORBUG-28806
Change-Id: Ic21c488cf1c173120beddf414ca39040dfaba096
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-04-03 11:31:54 +02:00
parent c53c9592fa
commit cb4074713f

View File

@@ -182,6 +182,7 @@ def std_1_string_dumper(d, value):
size = 0 size = 0
size_mode_value = 0 size_mode_value = 0
short_mode = False short_mode = False
libcxx_version = 14
layoutModeIsDSC = layoutDecider.name == '__data_' layoutModeIsDSC = layoutDecider.name == '__data_'
if (layoutModeIsDSC): if (layoutModeIsDSC):
@@ -200,8 +201,15 @@ def std_1_string_dumper(d, value):
if not size_mode: if not size_mode:
raise Exception("Could not find size_mode") raise Exception("Could not find size_mode")
size_mode_value = size_mode.integer() if size_mode.name == '__is_long_':
short_mode = ((size_mode_value & 1) == 0) libcxx_version = 15
short_mode = (size_mode.integer() == 0)
size_mode = D[1][0][1]
size_mode_value = size_mode.integer()
else:
size_mode_value = size_mode.integer()
short_mode = ((size_mode_value & 1) == 0)
if short_mode: if short_mode:
s = D[1] s = D[1]
@@ -209,8 +217,13 @@ def std_1_string_dumper(d, value):
if not s: if not s:
raise Exception("Could not find s") raise Exception("Could not find s")
location_sp = s[0] if layoutModeIsDSC else s[1] if libcxx_version == 14:
size = size_mode_value if layoutModeIsDSC else ((size_mode_value >> 1) % 256) location_sp = s[0] if layoutModeIsDSC else s[1]
size = size_mode_value if layoutModeIsDSC else ((size_mode_value >> 1) % 256)
elif libcxx_version == 15:
location_sp = s[0] if layoutModeIsDSC else s[2]
size = size_mode_value
else: else:
l = D[0] l = D[0]
if not l: if not l: