[Lldb-commits] [lldb] [lldb][test] TestDataFormatterLibcxxStringSimulator.py: fix padding for current layout (PR #108362)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Thu Sep 12 03:58:03 PDT 2024
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/108362
>From 8b999e3330f4b414d3ffe56c500d407cbde57be0 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Thu, 12 Sep 2024 11:05:27 +0100
Subject: [PATCH 1/2] [lldb][test] TestDataFormatterLibcxxStringSimulator.py:
fix padding for current layout
Drive-by:
* Also run expression evaluator on the string to
provide is with some extra coverage.
---
.../string/TestDataFormatterLibcxxStringSimulator.py | 3 +++
.../data-formatter-stl/libcxx-simulators/string/main.cpp | 6 +++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py
index 3e5c493692c4f0..98d2c7320003e4 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py
@@ -22,6 +22,9 @@ def _run_test(self, defines):
self.expect_var_path("shortstring", summary='"short"')
self.expect_var_path("longstring", summary='"I am a very long string"')
+ self.expect_expr("shortstring", result_summary='"short"')
+ self.expect_expr("longstring", result_summary='"I am a very long string"')
+
for v in [None, "ALTERNATE_LAYOUT"]:
for r in range(5):
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp
index 7beeb9c39de49e..74baeba6ec879b 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp
@@ -71,15 +71,15 @@ template <class _CharT, class _Traits, class _Allocator> class basic_string {
struct __short {
value_type __data_[__min_cap];
-#ifdef BITMASKS
#ifdef SUBCLASS_PADDING
struct : __padding<value_type> {
unsigned char __size_;
};
-#else
+#else // !SUBCLASS_PADDING
+
unsigned char __padding[sizeof(value_type) - 1];
+#ifdef BITMASKS
unsigned char __size_;
-#endif
#else // !BITMASKS
unsigned char __size_ : 7;
unsigned char __is_long_ : 1;
>From bcb09ad70ba5a350035ef43eab37ff3d585af856 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Thu, 12 Sep 2024 11:56:50 +0100
Subject: [PATCH 2/2] fixup! add missing endif
---
.../data-formatter-stl/libcxx-simulators/string/main.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp
index 74baeba6ec879b..b010dc25f8f804 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp
@@ -83,7 +83,8 @@ template <class _CharT, class _Traits, class _Allocator> class basic_string {
#else // !BITMASKS
unsigned char __size_ : 7;
unsigned char __is_long_ : 1;
-#endif
+#endif // BITMASKS
+#endif // SUBCLASS_PADDING
};
#ifdef BITMASKS
More information about the lldb-commits
mailing list