This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Make _LIBCPP_DEBUG_RANDOMIZE_RANGE a function
ClosedPublic

Authored by philnik on Jun 20 2022, 3:50 AM.

Diff Detail

Event Timeline

philnik created this revision.Jun 20 2022, 3:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2022, 3:50 AM
philnik requested review of this revision.Jun 20 2022, 3:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2022, 3:50 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante accepted this revision as: Mordante.Jun 20 2022, 10:46 AM

LGTM once the CI passes. I think it would be good for @ldionne to also have a look so I leave the final approval to him.

libcxx/include/__debug
30–31

Not your change, but I'm not really fond of this structure, where:

  • we include headers
  • write code
  • include more headers

Is there a reason why we can't move this code below the second set of includes and thus not have a small namespace std section?

ldionne requested changes to this revision.Jun 21 2022, 8:21 AM

I like this! I've been meaning to do this but didn't get around to it. I have some comments though.

libcxx/include/__debug
16

We'll need to include __algorithm/shuffle.h. For that reason, I think we need to pull this into another header (to avoid a bunch of headers suddenly including std::shuffle).

33–39

For unused params warning.

This revision now requires changes to proceed.Jun 21 2022, 8:21 AM
philnik updated this revision to Diff 439215.Jun 22 2022, 4:50 PM
philnik marked 3 inline comments as done.
  • Address comments
var-const accepted this revision as: var-const.Jun 23 2022, 6:52 PM
var-const added inline comments.
libcxx/include/__libcxx/debug_randomize_range.h
22 ↗(On Diff #439215)

Also HIDE_FROM_ABI?

ldionne accepted this revision.Jun 30 2022, 5:27 AM

LGTM once CI is green and all comments have been applied.

libcxx/include/CMakeLists.txt
328

Let's call this __debug_utils/randomize_range.h for now, and eventually we can actually rename it to __debug/randomize_range.h, and rename the current __debug header to something else. WDYT? __libcxx/ definitely looks out of place.

libcxx/include/__algorithm/partial_sort.h
22–23

This can be removed (here and in the other headers).

libcxx/include/__libcxx/debug_randomize_range.h
12 ↗(On Diff #439215)

Maybe guard this include with #ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY?

This revision is now accepted and ready to land.Jun 30 2022, 5:27 AM
philnik updated this revision to Diff 441403.Jun 30 2022, 8:05 AM
philnik marked 4 inline comments as done.
  • Address comments
philnik updated this revision to Diff 441634.Jul 1 2022, 1:35 AM
  • Generate files
philnik updated this revision to Diff 441950.Jul 3 2022, 6:56 AM
  • Fix includes
philnik updated this revision to Diff 441953.Jul 3 2022, 7:52 AM
  • Try to fix Modules

It looks like the ARM runners are currently broken and I've got a bad clang trunk. I'm landing this, but I'll keep an eye on the bootstrapping build.

This revision was landed with ongoing or failed builds.Jul 3 2022, 9:03 AM
This revision was automatically updated to reflect the committed changes.