This is an archive of the discontinued LLVM Phabricator instance.

Fix TestDataFormatterLibcxxListLoop.py test
ClosedPublic

Authored by teemperor on Feb 15 2019, 1:20 AM.

Details

Summary

The compilation of the TestDataFormatterLibcxxListLoop.py currently fails with this error:

functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/main.cpp:19:24: error: no member named '__value_' in 'std::__1::__list_node_base<int, void *>'
    assert(third_elem->__value_ == 3);
           ~~~~~~~~~~  ^

It seems the internal structure of list has changed with the 3.8 release. This patch makes the test compile with the current libc++ and with the previous libc++.

Diff Detail

Repository
rL LLVM

Event Timeline

teemperor created this revision.Feb 15 2019, 1:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2019, 1:20 AM
labath accepted this revision.Feb 15 2019, 1:39 AM

The slight problem here is that we don't know which libc++ version we are going to build with, so this will then fail for people still using the old one. However, choosing the latest libc++ version here seems like the right thing to do.

The background here is that we don't have a good way of testing that our pretty-printers behave sensibly when the structures they are interpreting get corrupted. This test was my attempt at improving that situation, but it's not without its shortfalls.

The other thing I tried a while back when writing the std::tuple formatter was to re-create a faithful mock of the class in the test. The advantage there would be that we are not tied to the libc++ version, and we would be even able to test formatting of different versions simultaneously. However, writing the mock proved to be so tedious, that I just gave up on the idea.

This revision is now accepted and ready to land.Feb 15 2019, 1:39 AM

We could also check the libc++ version via _LIBCPP_VERSION and just keep the old code around behind an ifdef?

Yeah, that sounds like a good interim solution.

teemperor updated this revision to Diff 186994.Feb 15 2019, 4:19 AM
teemperor edited the summary of this revision. (Show Details)
  • Added #ifdef for 3.8 release.

Thanks for fixing this.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2019, 4:13 AM