This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Guard much of std::ranges under _LIBCPP_HAS_NO_INCOMPLETE_RANGES.
ClosedPublic

Authored by ldionne on Feb 15 2022, 8:52 AM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Summary

The logic here is that we are disabling *only* things in std::ranges::.
Everything in std:: is permitted, including default_sentinel, contiguous_iterator,
common_iterator, projected, swappable, and so on. Then, we include
anything from std::ranges:: that is required in order to make those things
work: ranges::swap, ranges::swap_ranges, input_range, ranges::begin,
ranges::iter_move, and so on. But then that's all. Everything else (including
notably all of the "views" and the std::views namespace itself) is still
locked up behind _LIBCPP_HAS_NO_INCOMPLETE_RANGES.

Originally reviewed as https://reviews.llvm.org/D118736.

(cherry picked from commit 53406fb691db38b21decf233e091f648f8317b2d)

Diff Detail

Event Timeline

ldionne requested review of this revision.Feb 15 2022, 8:52 AM
ldionne created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2022, 8:52 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript

This is just the cherry-pick commit onto release/14.x -- I just want to make sure that things are sane before committing.

ldionne accepted this revision.Feb 15 2022, 12:15 PM
  • ASAN failures are expected.
  • I'll fix the filesystem issue by cherry-picking 7dad5f84f1b8a7aafd5a27ce2889bd72a1e54002.
  • The macOS x86_64 issue is a common Debug mode issue, I haven't investigated but un-breaking the debug mode as a whole should fix that (I'm working on that).
This revision is now accepted and ready to land.Feb 15 2022, 12:15 PM
ldionne closed this revision.Feb 15 2022, 12:17 PM

Landed this:

commit dfc24b8522ba9943e20bc4162d42d6b49bf85214 (origin/release/14.x, release/14.x)
Author: Konstantin Varlamov <varconst@apple.com>
Date:   Fri Feb 11 11:56:29 2022 -0800

    [libc++][NFC] Work around false positive ODR violations from ASan.

    This works around a known issue in ASan. ASan doesn't instrument weak
    symbols. Because instrumentation increases object size, the binary can
    end up with two versions of the same object, one instrumented and one
    not instrumented, with different sizes, which ASan will report as an ODR
    violation. In libc++, this affects typeinfo for `std::bad_function_call`
    which is emitted as a weak symbol in the test executable and as a strong
    symbol in the shared library.

    The main open issue for ASan appears to be
    https://github.com/google/sanitizers/issues/1017.

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

    (cherry picked from commit 10953974ed6b61247fd4b070b3a6e390e02d0edb)

commit 199e05e34bb8beb1cafce3a086932a32c493fa13
Author: Louis Dionne <ldionne.2@gmail.com>
Date:   Tue Feb 15 15:10:27 2022 -0500

    [libc++] Add missing UNSUPPORTED for the has-no-incomplete-ranges test

    This wasn't caught because we don't test the combination of no-filesystem
    and no-experimental-features in the CI.

    (cherry picked from commit 7dad5f84f1b8a7aafd5a27ce2889bd72a1e54002)

commit 7fdca71be63aa2abad2bff099c6754938a2fe4fc
Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Date:   Tue Feb 1 16:52:02 2022 -0500

    [libc++] Guard much of std::ranges under _LIBCPP_HAS_NO_INCOMPLETE_RANGES.

    The logic here is that we are disabling *only* things in `std::ranges::`.
    Everything in `std::` is permitted, including `default_sentinel`, `contiguous_iterator`,
    `common_iterator`, `projected`, `swappable`, and so on. Then, we include
    anything from `std::ranges::` that is required in order to make those things
    work: `ranges::swap`, `ranges::swap_ranges`, `input_range`, `ranges::begin`,
    `ranges::iter_move`, and so on. But then that's all. Everything else (including
    notably all of the "views" and the `std::views` namespace itself) is still
    locked up behind `_LIBCPP_HAS_NO_INCOMPLETE_RANGES`.

    Originally reviewed as https://reviews.llvm.org/D118736.

    (cherry picked from commit 53406fb691db38b21decf233e091f648f8317b2d)

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