Skip to content

Commit

Permalink
[DataFormatters] Adjusting libc++ std::list formatter to act better w…
Browse files Browse the repository at this point in the history
…ith pointers and references and adding a test to cover a previous related fix

Summary:
This previous fix llvm-mirror/lldb@5469bda did not have a test since we did not have a reproducer.

This is related to how formatters deal with pointers and references. The added tests both the new behavior and covers the previous bug fix as well.

Differential Revision: https://reviews.llvm.org/D60588

llvm-svn: 359118
  • Loading branch information
shafik committed Apr 24, 2019
1 parent 33d806a commit abdb816
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Expand Up @@ -162,6 +162,10 @@ def cleanup():
'[2] = ', '3',
'[3] = ', '4'])

ListPtr = self.frame().FindVariable("list_ptr")
self.assertTrue(ListPtr.GetChildAtIndex(
0).GetValueAsUnsigned(0) == 1, "[0] = 1")

# check that MightHaveChildren() gets it right
self.assertTrue(
self.frame().FindVariable("numbers_list").MightHaveChildren(),
Expand Down
Expand Up @@ -8,7 +8,8 @@ typedef std::list<std::string> string_list;
int main()
{
int_list numbers_list;

std::list<int>* list_ptr = &numbers_list;

printf("// Set break point at this line.");
(numbers_list.push_back(0x12345678));
(numbers_list.push_back(0x11223344));
Expand Down
Expand Up @@ -486,7 +486,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
cpp_category_sp,
lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator,
"libc++ std::list synthetic children",
ConstString("^std::__[[:alnum:]]+::list<.+>(( )?&)?$"), stl_synth_flags,
ConstString("^std::__[[:alnum:]]+::list<.+>(( )?&)?$"), stl_deref_flags,
true);
AddCXXSynthetic(
cpp_category_sp,
Expand Down

0 comments on commit abdb816

Please sign in to comment.