This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6703812688b8: [LLDB][DataFormatter] Add support for
std::__map_const_iterator (authored by Michael137).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129962/new/
https://reviews.llvm.org/D129962
Files:
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp
Index:
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp
===================================================================
---
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp
+++
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp
@@ -24,7 +24,12 @@
ii[0] = 0; // Set break point at this line.
ii[1] = 1;
- thefoo_rw(1); // Set break point at this line.
+
+ intint_map::iterator it = ii.begin();
+ intint_map::const_iterator const_it = ii.cbegin();
+ std::printf("%d %d\n", it->second, const_it->second);
+
+ thefoo_rw(1); // Set break point at this line.
ii[2] = 0;
ii[3] = 1;
thefoo_rw(1); // Set break point at this line.
Index:
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
===================================================================
---
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
+++
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
@@ -116,6 +116,16 @@
substrs=['first =',
'second ='])
+ # (Non-)const key/val iterators
+ self.expect_expr("it", result_children=[
+ ValueCheck(name="first", value="0"),
+ ValueCheck(name="second", value="0")
+ ])
+ self.expect_expr("const_it", result_children=[
+ ValueCheck(name="first", value="0"),
+ ValueCheck(name="second", value="0")
+ ])
+
# check that MightHaveChildren() gets it right
self.assertTrue(
self.frame().FindVariable("ii").MightHaveChildren(),
Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===================================================================
--- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -909,7 +909,7 @@
cpp_category_sp,
lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEndCreator,
"std::map iterator synthetic children",
- ConstString("^std::__[[:alnum:]]+::__map_iterator<.+>$"),
stl_synth_flags,
+ ConstString("^std::__[[:alnum:]]+::__map_(const_)?iterator<.+>$"),
stl_synth_flags,
true);
AddCXXSynthetic(
Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp
===================================================================
--- lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp
@@ -24,7 +24,12 @@
ii[0] = 0; // Set break point at this line.
ii[1] = 1;
- thefoo_rw(1); // Set break point at this line.
+
+ intint_map::iterator it = ii.begin();
+ intint_map::const_iterator const_it = ii.cbegin();
+ std::printf("%d %d\n", it->second, const_it->second);
+
+ thefoo_rw(1); // Set break point at this line.
ii[2] = 0;
ii[3] = 1;
thefoo_rw(1); // Set break point at this line.
Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
===================================================================
--- lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
@@ -116,6 +116,16 @@
substrs=['first =',
'second ='])
+ # (Non-)const key/val iterators
+ self.expect_expr("it", result_children=[
+ ValueCheck(name="first", value="0"),
+ ValueCheck(name="second", value="0")
+ ])
+ self.expect_expr("const_it", result_children=[
+ ValueCheck(name="first", value="0"),
+ ValueCheck(name="second", value="0")
+ ])
+
# check that MightHaveChildren() gets it right
self.assertTrue(
self.frame().FindVariable("ii").MightHaveChildren(),
Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===================================================================
--- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -909,7 +909,7 @@
cpp_category_sp,
lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEndCreator,
"std::map iterator synthetic children",
- ConstString("^std::__[[:alnum:]]+::__map_iterator<.+>$"), stl_synth_flags,
+ ConstString("^std::__[[:alnum:]]+::__map_(const_)?iterator<.+>$"), stl_synth_flags,
true);
AddCXXSynthetic(
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits