This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Refactor the mandatory header inclusion tests to .gen.py
ClosedPublic

Authored by ldionne on May 31 2023, 12:37 PM.

Details

Summary

This allows removing a bunch of boilerplate from the test suite and
reducing the amount of manual stuff contributors have to do when they
add a new public header.

Diff Detail

Event Timeline

ldionne created this revision.May 31 2023, 12:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2023, 12:37 PM
ldionne requested review of this revision.May 31 2023, 12:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2023, 12:37 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne added inline comments.May 31 2023, 12:39 PM
libcxx/utils/generate_header_inclusion_tests.py
98

This way of enabling/disabling the tests is better than #ifdef. In this patch, the new tests are using #ifdef to be consistent with other .gen.py tests, but a future patch I have locally will transition everything to UNSUPPORTED markup instead.

Mordante added inline comments.
libcxx/include/typeinfo
11 ↗(On Diff #527163)

Please land this as a separate NFC commit.

libcxx/test/libcxx/header_inclusions.gen.py
13

Not really related to this patch, but could a followup also validate __assert is included?

libcxx/utils/generate_header_inclusion_tests.py
98

Would it be possible to post these as stacked commits? That makes it easier to determine how happy I am with this patch. I feel we loose some nice features, but when I see how they will return I probably feel better about the temporary loss.

ldionne updated this revision to Diff 527425.Jun 1 2023, 8:17 AM
ldionne marked 3 inline comments as done.

Fix CI and address comments.

ldionne added inline comments.
libcxx/test/libcxx/header_inclusions.gen.py
13

This is already done in the libcxx/test/libcxx/assertions/headers_declare_verbose_abort.gen.py test.

libcxx/utils/generate_header_inclusion_tests.py
98
ldionne updated this revision to Diff 527533.Jun 1 2023, 11:23 AM

Rebase onto windows fix to try and make CI happy.

Mordante accepted this revision.Jun 1 2023, 1:10 PM

LGTM!

This revision is now accepted and ready to land.Jun 1 2023, 1:10 PM
libcxx/test/libcxx/inclusions/variant.inclusions.compile.pass.cpp