Skip to content
Open
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
b79fe5b
Add libcpp header modifications doc file in .md
123R3N321 Mar 23, 2026
10d26e7
Create test file for cpp compilation
123R3N321 Mar 23, 2026
68c5f23
Modify lind_compile script for cpp compilation
123R3N321 Mar 23, 2026
7501bac
Update cpp_compile.md
123R3N321 Mar 23, 2026
e583137
Update .gitignore
123R3N321 Mar 23, 2026
b3ab4d6
Add .cmake for wasi compilation
123R3N321 Mar 23, 2026
412310a
Add build-llvm.sh
123R3N321 Mar 23, 2026
1433aad
Add build script for llvm archives
123R3N321 Mar 23, 2026
ec1f9f5
Update cpp_compile.md
123R3N321 Mar 23, 2026
a2dc3dd
Restore scripts/lind_compile to pass CI
123R3N321 Apr 1, 2026
a176bfb
Fix Makefile test command syntax error
123R3N321 Apr 1, 2026
bd589ee
Revert Makefile changes, rework all other ci additions.
123R3N321 Apr 6, 2026
0af8aa0
Update Dockerfile.e2e
123R3N321 Apr 6, 2026
93b87ab
Modify Dockerfile.e2e
123R3N321 Apr 6, 2026
a7fddc4
Update Dockerfile.e2e
123R3N321 Apr 6, 2026
da99835
Fix Dockerfile.e2e syntax error.
123R3N321 Apr 6, 2026
7f951dc
Modify Dockerfile.e2e
123R3N321 Apr 6, 2026
aba21c8
Modify Dockerfile.e2e
123R3N321 Apr 6, 2026
e01bcc7
Update Dockerfile.e2e
123R3N321 Apr 6, 2026
62027e3
Modify Dokcerfile.e2e
123R3N321 Apr 6, 2026
b7c73a3
Modify Dockerfile.e2e
123R3N321 Apr 6, 2026
c017038
Modify Dockerfile.e2e
123R3N321 Apr 6, 2026
29897a7
Refactor cpp test file dir
123R3N321 Apr 13, 2026
8c95fc1
Modify e2e.yml
123R3N321 Apr 13, 2026
ed29ed2
Modify e2e.yml report upload behavior
123R3N321 Apr 13, 2026
709d1a9
Modify e2e.yml
123R3N321 Apr 15, 2026
8933f91
Modify e2e.yml
123R3N321 Apr 20, 2026
fcdbc7f
Remove standalone libcpp header CI flow.
123R3N321 Apr 22, 2026
2d7fb9c
Modify e2e.yml
123R3N321 Apr 22, 2026
45f5b4b
Merge branch 'main' into libcpp-ren
123R3N321 Apr 22, 2026
25ea9a8
Modify e2e.yml permission to read
123R3N321 Apr 22, 2026
65de0d3
Restore e2e.yml permission to write
123R3N321 Apr 22, 2026
28ae252
Modify e2e.yml
123R3N321 Apr 22, 2026
dc3e692
Fix e2e.yml privilege syntax
123R3N321 Apr 22, 2026
6c7cf75
Add harness py script for libcpp to be reflected in report gen.
123R3N321 Apr 22, 2026
834d05e
Add libcpp json existence check to make test command.
123R3N321 Apr 22, 2026
89cc301
Add steps to make report generation call.
123R3N321 Apr 22, 2026
8ddf1f4
Adjust e2e.yml \n Remove secondary libcpp header testing job.
123R3N321 Apr 22, 2026
af40e41
Add command to migrate compiled llvm artifacts to sysroot for cpp com…
123R3N321 Apr 22, 2026
ff78a29
remove stale sysroot from glibc
123R3N321 Apr 22, 2026
00fb2b3
Modify libcpp harness.
123R3N321 Apr 22, 2026
7454c05
Adjust html rendering text.
123R3N321 Apr 22, 2026
5f0c9a0
Add .wasm execution with scripts/lind_run call on artifact compiled f…
123R3N321 Apr 24, 2026
bbbf807
Modify cpp unit test case behavior.
123R3N321 Apr 24, 2026
fca0425
Remove deprecated trial/ dir used for .cpp testing; change reflected …
123R3N321 Apr 24, 2026
4a0f278
Move libcpp header integration documentation into docs; edits needed.
123R3N321 Apr 24, 2026
a77bab2
Modify libcpp harness file; add cwasm cleansing after build and run.
123R3N321 Apr 24, 2026
6315d0c
Modify cpp test main func signature; fix to avoid argv count mismatch…
123R3N321 Apr 24, 2026
4ae9098
Move libcpp header doc; Remove old doc.
123R3N321 Apr 24, 2026
52bb73a
Remove artifact build scripts.
123R3N321 Apr 26, 2026
a0ac0bb
Modify lind_compile_cpp script; clean stale lind_compile content.
123R3N321 Apr 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
47 changes: 27 additions & 20 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
pull-requests: write
contents: read

jobs:
docker:
docker_e2e:
permissions:
contents: read
pull-requests: write
# If the workflow was triggered by anything other than a pull_request event
# (e.g., push, workflow_dispatch, schedule, pull_request_target),
# github.event_name != 'pull_request' is true.
Expand All @@ -34,24 +37,22 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0

# First attempt at build
- name: Build e2e (attempt 1)
id: build_e2e_try1
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
with:
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
file: Docker/Dockerfile.e2e
file: Docker/Dockerfile.e2e
target: artifacts
tags: e2e:latest
outputs: type=local,dest=${{ env.REPORT_LOCAL_DIR }}

# Small backoff if it failed
- name: Backoff (after try 1)
if: steps.build_e2e_try1.outcome == 'failure'
if: ${{ always() && steps.build_e2e_try1.outcome == 'failure' }}
run: sleep 15

# Second attempt

- name: Build e2e (attempt 2)
id: build_e2e_try2
if: steps.build_e2e_try1.outcome == 'failure'
Expand All @@ -60,16 +61,15 @@ jobs:
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
file: Docker/Dockerfile.e2e
file: Docker/Dockerfile.e2e
target: artifacts
tags: e2e:latest
outputs: type=local,dest=${{ env.REPORT_LOCAL_DIR }}

# Slightly Longer Backoff if it failed again

- name: Backoff (after try 2)
if: steps.build_e2e_try2.outcome == 'failure'
if: ${{ always() && steps.build_e2e_try2.outcome == 'failure' }}
run: sleep 30

# Third and final attempt
- name: Build e2e (attempt 3)
id: build_e2e_try3
if: steps.build_e2e_try2.outcome == 'failure'
Expand All @@ -78,20 +78,27 @@ jobs:
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
file: Docker/Dockerfile.e2e
file: Docker/Dockerfile.e2e
target: artifacts
tags: e2e:latest
outputs: type=local,dest=${{ env.REPORT_LOCAL_DIR }}

- name: Fail if all e2e build attempts failed
if: ${{ always() && steps.build_e2e_try1.outcome == 'failure' && steps.build_e2e_try2.outcome == 'failure' && steps.build_e2e_try3.outcome == 'failure' }}
run: |
echo "All e2e build attempts failed"
exit 1

- name: Read test status
id: e2e
if: ${{ always() }}
run: |
STATUS_FILE="${{ env.REPORT_LOCAL_DIR }}/e2e_status"
echo "Checking status file at: $STATUS_FILE"
echo "----- File contents (if any) -----"
if [[ -f "$STATUS_FILE" ]]; then
cat "$STATUS_FILE"
# export to step output AND job env
cat "$STATUS_FILE" >> "$GITHUB_OUTPUT" # writes E2E_STATUS=pass|fail
cat "$STATUS_FILE" >> "$GITHUB_OUTPUT"
cat "$STATUS_FILE" >> "$GITHUB_ENV"
else
echo "(none)"
Expand Down Expand Up @@ -136,7 +143,7 @@ jobs:
${{ env.REPORT_LOCAL_DIR }}/${{ env.REPORT_LOCAL_FILE }}
if-no-files-found: error
retention-days: 7

- name: Post PR comment
# Run only on branch PRs, not on fork PRs
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
Expand All @@ -148,10 +155,10 @@ jobs:
const body = fs.readFileSync(path, 'utf8');
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
await github.rest.issues.createComment({ owner, repo, issue_number, body });
await github.rest.issues.createComment({ owner, repo, issue_number, body });

- name: Fail if tests failed
if: steps.e2e.outputs.E2E_STATUS == 'fail'
if: ${{ always() && steps.e2e.outputs.E2E_STATUS == 'fail' }}
run: |
echo "Tests failed; failing job after posting the report/comment."
exit 1
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ report.html

#Ignore python cache
__pycache__/

#Ignore llvm external dependency needed for libcpp headers
llvm-project/
libcxx-*/
Comment thread
123R3N321 marked this conversation as resolved.
78 changes: 72 additions & 6 deletions Docker/Dockerfile.e2e
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,11 @@ RUN chmod 0755 /scripts/lind_compile /scripts/lind_run /scripts/cargo-lind_compi
# Run all tests, print results, and exit with 1, if any test fails; 0 otherwise
FROM base AS test
ENV LIND_WASM_ROOT=/
COPY --parents scripts tests tools skip_test_cases.txt Makefile .
RUN chmod 0755 /scripts/test_runner.py /scripts/lind_compile /scripts/lind_run \
COPY --parents scripts tests tools skip_test_cases.txt Makefile artifacts .
RUN chmod 0755 /scripts/test_runner.py /scripts/lind_compile /scripts/lind_compile_cpp /scripts/lind_run \
&& chmod 0755 /scripts/cargo-lind_compile \
&& ln -sf /scripts/lind_compile /usr/local/bin/lind_compile \
&& ln -sf /scripts/lind_compile_cpp /usr/local/bin/lind_compile_cpp \
&& ln -sf /scripts/lind_run /usr/local/bin/lind_run \
&& install -D -m 0755 /scripts/cargo-lind_compile /usr/local/bin/cargo-lind_compile \
&& ln -sf /usr/local/bin/lind_compile /usr/local/bin/lind-clang \
Expand All @@ -175,18 +176,83 @@ RUN chmod 0755 /scripts/test_runner.py /scripts/lind_compile /scripts/lind_run \
RUN mkdir -p /home/lind && ln -sf / /home/lind/lind-wasm
# NOTE: Build artifacts from prior stages are only mounted, to save COPY time
# and cache layers. This means they are not preserved in the resulting image.
# Mirrors local `make sysroot`: populate build/sysroot then merge libc++ from
# artifacts/ (Makefile sync-sysroot does the same when ARTIFACTS_DIR is present).
# lind_compile(_cpp) prefer SYSROOT under build/sysroot when present.
RUN --mount=from=build-lind-boot,source=src/lind-boot/target,destination=src/lind-boot/target \
--mount=from=build-lind-boot,source=build/lind-boot,destination=/build/lind-boot \
--mount=from=build-glibc,source=lindfs,destination=/prebuilt-lindfs,readonly \
--mount=from=build-glibc,source=src/glibc/sysroot,destination=src/glibc/sysroot \
make PREBUILT_LINDFS_ROOT=/prebuilt-lindfs \
LIND_RUNTIME_LINDFS_ALIAS=/home/lind/lind-wasm/lindfs \
test && \
make md_generation OUT=/ REPORT=/report.html
--mount=from=build-glibc,source=build/sysroot,destination=/mnt/glibc-build-sysroot,readonly \
bash -lc 'set -euxo pipefail; \
cd /; \
test -d artifacts/include/wasm32-wasi/c++; \
test -f artifacts/lib/wasm32-wasi/libc++.a; \
test -f artifacts/lib/wasm32-wasi/libc++abi.a; \
rm -rf /build/sysroot; \
mkdir -p /build/sysroot; \
cp -a /mnt/glibc-build-sysroot/. /build/sysroot/; \
mkdir -p /build/sysroot/include/wasm32-wasi; \
mkdir -p /build/sysroot/lib/wasm32-wasi; \
rm -rf /build/sysroot/include/wasm32-wasi/c++; \
cp -r artifacts/include/wasm32-wasi/c++ /build/sysroot/include/wasm32-wasi/; \
rm -f /build/sysroot/lib/wasm32-wasi/libc++.a /build/sysroot/lib/wasm32-wasi/libc++abi.a; \
cp artifacts/lib/wasm32-wasi/libc++.a artifacts/lib/wasm32-wasi/libc++abi.a /build/sysroot/lib/wasm32-wasi/; \
make PREBUILT_LINDFS_ROOT=/prebuilt-lindfs \
LIND_RUNTIME_LINDFS_ALIAS=/home/lind/lind-wasm/lindfs \
test && \
make md_generation OUT=/ REPORT=/report.html'


FROM scratch AS artifacts
COPY --from=test /report.html /wasm-e2e-report.html
COPY --from=test /reports /reports
COPY --from=test /e2e_comment.md /e2e_comment.md
COPY --from=test /e2e_status /e2e_status

FROM base AS libcpp-test
ENV LIND_WASM_ROOT=/
COPY --parents scripts tests/unit-tests/cpp artifacts Makefile .
RUN chmod 0755 /scripts/lind_compile /scripts/lind_compile_cpp /scripts/lind_run \
&& install -D -m 0755 /scripts/lind_compile /usr/local/bin/lind_compile \
&& install -D -m 0755 /scripts/lind_compile_cpp /usr/local/bin/lind_compile_cpp \
&& install -D -m 0755 /scripts/lind_run /usr/local/bin/lind_run \
&& ln -sf /usr/local/bin/lind_compile /usr/local/bin/lind-clang \
&& ln -sf /usr/local/bin/lind_run /usr/local/bin/lind-wasm

RUN mkdir -p /home/lind && ln -sf / /home/lind/lind-wasm

RUN --mount=from=build-lind-boot,source=build/lind-boot,destination=/mnt/lind-boot \
--mount=from=build-glibc,source=build/sysroot,destination=/mnt/sysroot \
bash -lc 'set -euxo pipefail; \
cd /; \
find artifacts -maxdepth 4 | sort; \
test -d artifacts/include/wasm32-wasi/c++; \
test -f artifacts/lib/wasm32-wasi/libc++.a; \
test -f artifacts/lib/wasm32-wasi/libc++abi.a; \
rm -rf /build/sysroot; \
mkdir -p /build/sysroot; \
cp -a /mnt/sysroot/. /build/sysroot/; \
mkdir -p /build; \
cp -a /mnt/lind-boot /build/lind-boot; \
chmod 0755 /build/lind-boot; \
mkdir -p build/sysroot/include/wasm32-wasi; \
mkdir -p build/sysroot/lib/wasm32-wasi; \
rm -rf build/sysroot/include/wasm32-wasi/c++; \
cp -r artifacts/include/wasm32-wasi/c++ build/sysroot/include/wasm32-wasi/; \
rm -f build/sysroot/lib/wasm32-wasi/libc++.a build/sysroot/lib/wasm32-wasi/libc++abi.a; \
cp artifacts/lib/wasm32-wasi/libc++.a artifacts/lib/wasm32-wasi/libc++abi.a build/sysroot/lib/wasm32-wasi/; \
rm -f tests/unit-tests/cpp/*.wasm; \
scripts/lind_compile_cpp --print-args --print-cmd --compile-only tests/unit-tests/cpp/hello.cpp; \
test -f tests/unit-tests/cpp/hello.cpp.wasm'

RUN bash -lc 'set -euxo pipefail; \
mkdir -p /libcpp-out; \
cp /tests/unit-tests/cpp/hello.cpp.wasm /libcpp-out/hello.cpp.wasm; \
printf "%s\n" "LIBCPP_STATUS=pass" > /libcpp-out/libcpp_status; \
ls -la /libcpp-out; \
test -f /libcpp-out/hello.cpp.wasm; \
test -f /libcpp-out/libcpp_status'

FROM scratch AS libcpp-artifacts
COPY --from=libcpp-test /libcpp-out/ /
22 changes: 22 additions & 0 deletions Docker/Dockerfile.libcpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Reuse the same base/build logic style as Dockerfile.e2e

FROM base AS build-libcpp

COPY . .

RUN make sysroot

RUN cp -r artifacts/include/wasm32-wasi/. build/sysroot/include/wasm32-wasi/ \
&& cp -r artifacts/lib/wasm32-wasi/. build/sysroot/lib/wasm32-wasi/

RUN chmod +x scripts/lind_compile_cpp \
&& rm -f tests/unit-tests/cpp/*.wasm \
&& scripts/lind_compile_cpp tests/unit-tests/cpp/hello.cpp \
&& test -n "$(find tests/unit-tests/cpp -maxdepth 1 -type f -name '*.wasm' | head -n 1)"

RUN mkdir -p /out \
&& cp "$(find tests/unit-tests/cpp -maxdepth 1 -type f -name '*.wasm' | head -n 1)" /out/hello.cpp.wasm \
&& printf '%s\n' 'LIBCPP_STATUS=pass' > /out/libcpp_status

FROM scratch
COPY --from=build-libcpp /out/ /
21 changes: 20 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
LINDFS_ROOT ?= lindfs
BUILD_DIR ?= build
SYSROOT_DIR ?= $(BUILD_DIR)/sysroot
# Prebuilt libc++ headers/libs; merged into $(SYSROOT_DIR) by sync-sysroot when present.
ARTIFACTS_DIR ?= artifacts
LINDBOOT_BIN ?= $(BUILD_DIR)/lind-boot
LINDBOOT_DEBUG_BIN ?= $(BUILD_DIR)/lind-boot-debug
LINDFS_DIRS := \
Expand Down Expand Up @@ -72,10 +74,26 @@ build_glibc:
build-dir:
mkdir -p $(BUILD_DIR)

# After copying src/glibc/sysroot → $(SYSROOT_DIR), optionally merge libc++ from
# $(ARTIFACTS_DIR) when that tree is present (same layout as Docker E2E).
# Remove any existing c++ tree first: it may be a symlink into src/glibc/sysroot
# (e.g. read-only in Docker), and cp -r into that path would hit EROFS.

.PHONY: sync-sysroot
sync-sysroot:
$(RM) -r $(SYSROOT_DIR)
cp -R src/glibc/sysroot $(SYSROOT_DIR)
@if [ -d "$(ARTIFACTS_DIR)/include/wasm32-wasi/c++" ] \
&& [ -f "$(ARTIFACTS_DIR)/lib/wasm32-wasi/libc++.a" ] \
&& [ -f "$(ARTIFACTS_DIR)/lib/wasm32-wasi/libc++abi.a" ]; then \
echo "Merging libc++ from $(ARTIFACTS_DIR) into $(SYSROOT_DIR)"; \
mkdir -p $(SYSROOT_DIR)/include/wasm32-wasi; \
mkdir -p $(SYSROOT_DIR)/lib/wasm32-wasi; \
$(RM) -r $(SYSROOT_DIR)/include/wasm32-wasi/c++; \
cp -r $(ARTIFACTS_DIR)/include/wasm32-wasi/c++ $(SYSROOT_DIR)/include/wasm32-wasi/; \
$(RM) -f $(SYSROOT_DIR)/lib/wasm32-wasi/libc++.a $(SYSROOT_DIR)/lib/wasm32-wasi/libc++abi.a; \
cp $(ARTIFACTS_DIR)/lib/wasm32-wasi/libc++.a $(ARTIFACTS_DIR)/lib/wasm32-wasi/libc++abi.a $(SYSROOT_DIR)/lib/wasm32-wasi/; \
fi

.PHONY: test
test: lindfs
Expand Down Expand Up @@ -122,9 +140,10 @@ test: lindfs
if [ ! -f reports/report.html ]; then cp report.html reports/report.html; fi; \
if [ ! -f reports/wasm.json ]; then printf '%s\n' '{"number_of_failures":1,"results":[],"error":"missing wasm report"}' > reports/wasm.json; fi; \
if [ ! -f reports/grates.json ]; then printf '%s\n' '{"number_of_failures":1,"results":[],"error":"missing grate report"}' > reports/grates.json; fi; \
if [ ! -f reports/libcpp.json ]; then printf '%s\n' '{"number_of_failures":1,"results":[],"error":"missing libcpp report"}' > reports/libcpp.json; fi; \
fi; \
exit 0

.PHONY: md_generation
OUT ?= .
REPORT ?= report.html
Expand Down
27 changes: 27 additions & 0 deletions Toolchain-WASI.cmake
Comment thread
123R3N321 marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Toolchain-WASI.cmake
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR wasm32)

set(CLANG_BIN "/home/lind/lind-wasm/clang+llvm-18.1.8-x86_64-linux-gnu-ubuntu-18.04/bin")
set(CMAKE_C_COMPILER "${CLANG_BIN}/clang")
set(CMAKE_CXX_COMPILER "${CLANG_BIN}/clang++")
set(CMAKE_LINKER "${CLANG_BIN}/bin/wasm-ld")
set(CMAKE_SYSROOT "/home/lind/lind-wasm/build/sysroot")

set(CMAKE_C_COMPILER_TARGET wasm32-unknown-wasi)
set(CMAKE_CXX_COMPILER_TARGET wasm32-unknown-wasi)

set(CMAKE_C_FLAGS_INIT "-pthread -matomics -mbulk-memory -static -nostdlib -nodefaultlibs -fno-exceptions -fno-unwind-tables")
set(CMAKE_CXX_FLAGS_INIT "-frtti -pthread -matomics -mbulk-memory -static -nostdlib -nodefaultlibs -fno-exceptions -stdlib=libc++ -fno-unwind-tables")
set(CMAKE_EXE_LINKER_FLAGS_INIT "-static -nostdlib -nodefaultlibs")

# Optional: disable rpath injection
set(CMAKE_SKIP_RPATH ON)

# These fix platform error
set(LLVM_HOST_TRIPLE "wasm32-wasip1")
set(LLVM_DEFAULT_TARGET_TRIPLE "wasm32-wasip1")

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
58 changes: 58 additions & 0 deletions artifacts/include/wasm32-wasi/c++/v1/__algorithm/adjacent_find.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP___ALGORITHM_ADJACENT_FIND_H
#define _LIBCPP___ALGORITHM_ADJACENT_FIND_H

#include <__algorithm/comp.h>
#include <__algorithm/iterator_operations.h>
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__utility/move.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif

_LIBCPP_PUSH_MACROS
#include <__undef_macros>

_LIBCPP_BEGIN_NAMESPACE_STD

template <class _Iter, class _Sent, class _BinaryPredicate>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter
__adjacent_find(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) {
if (__first == __last)
return __first;
_Iter __i = __first;
while (++__i != __last) {
if (__pred(*__first, *__i))
return __first;
__first = __i;
}
return __i;
}

template <class _ForwardIterator, class _BinaryPredicate>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) {
return std::__adjacent_find(std::move(__first), std::move(__last), __pred);
}

template <class _ForwardIterator>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
adjacent_find(_ForwardIterator __first, _ForwardIterator __last) {
return std::adjacent_find(std::move(__first), std::move(__last), __equal_to());
}

_LIBCPP_END_NAMESPACE_STD

_LIBCPP_POP_MACROS

#endif // _LIBCPP___ALGORITHM_ADJACENT_FIND_H
Loading