Compare commits
2 Commits
main
...
fix/server
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42a3d20971 | ||
|
|
dfeda4dc6f |
@@ -1,40 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ""
|
||||
labels: ""
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -1,19 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ""
|
||||
labels: ""
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -1,20 +0,0 @@
|
||||
name: "Setup Pixi"
|
||||
description: "setup pixi"
|
||||
|
||||
inputs:
|
||||
environments:
|
||||
description: "The pixi environments to install (e.g. default, docs, test)"
|
||||
required: false
|
||||
default: "default"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup Pixi
|
||||
uses: prefix-dev/setup-pixi@v0.9.3
|
||||
with:
|
||||
pixi-version: v0.67.0
|
||||
environments: ${{ inputs.environments }}
|
||||
activate-environment: true
|
||||
cache: true
|
||||
locked: true
|
||||
@@ -1,44 +0,0 @@
|
||||
name: benchmark
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
benchmark:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-24.04, macos-15, windows-2025]
|
||||
runs-on: ${{ matrix.os }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
|
||||
- name: Build scan_benchmark
|
||||
run: |
|
||||
pixi run cmake-config RelWithDebInfo ON -- -DCLICE_ENABLE_BENCHMARK=ON
|
||||
cmake --build build/RelWithDebInfo --target scan_benchmark
|
||||
|
||||
- name: Clone LLVM
|
||||
run: git clone --depth 1 https://github.com/llvm/llvm-project.git
|
||||
|
||||
- name: Generate CDB
|
||||
run: |
|
||||
cmake -B llvm-build -G Ninja \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$(pwd)/cmake/toolchain.cmake" \
|
||||
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;lldb;mlir;polly;flang;bolt" \
|
||||
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \
|
||||
llvm-project/llvm
|
||||
|
||||
- name: Run benchmark
|
||||
run: ./build/RelWithDebInfo/bin/scan_benchmark --runs 20 llvm-build/compile_commands.json
|
||||
|
||||
- name: Stop sccache server
|
||||
if: runner.os == 'Windows'
|
||||
run: pixi run -- sccache --stop-server || true
|
||||
@@ -1,446 +0,0 @@
|
||||
name: build llvm
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
llvm_version:
|
||||
description: "LLVM version to build (e.g., 21.1.8)"
|
||||
required: true
|
||||
type: string
|
||||
skip_upload:
|
||||
description: "Skip upload and PR creation (build-only mode)"
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
skip_pr:
|
||||
description: "Skip PR creation (upload only, no PR)"
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
pull_request:
|
||||
# if you want to run this workflow, change the branch name to main,
|
||||
# if you want to turn off it, change it to non existent branch.
|
||||
branches: [main-turn-off]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# Native builds
|
||||
- os: windows-2025
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: OFF
|
||||
- os: windows-2025
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: ON
|
||||
- os: ubuntu-24.04
|
||||
llvm_mode: Debug
|
||||
lto: OFF
|
||||
- os: ubuntu-24.04
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: OFF
|
||||
- os: ubuntu-24.04
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: ON
|
||||
- os: macos-15
|
||||
llvm_mode: Debug
|
||||
lto: OFF
|
||||
- os: macos-15
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: OFF
|
||||
- os: macos-15
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: ON
|
||||
|
||||
# Cross-compilation builds
|
||||
# macOS x64 (from arm64 macos-15)
|
||||
- os: macos-15
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: OFF
|
||||
target_triple: x86_64-apple-darwin
|
||||
- os: macos-15
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: ON
|
||||
target_triple: x86_64-apple-darwin
|
||||
|
||||
# Linux aarch64 (from x64 ubuntu-24.04)
|
||||
- os: ubuntu-24.04
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: OFF
|
||||
target_triple: aarch64-linux-gnu
|
||||
pixi_env: cross-linux-aarch64
|
||||
- os: ubuntu-24.04
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: ON
|
||||
target_triple: aarch64-linux-gnu
|
||||
pixi_env: cross-linux-aarch64
|
||||
|
||||
# Windows arm64 (from x64 windows-2025)
|
||||
- os: windows-2025
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: OFF
|
||||
target_triple: aarch64-pc-windows-msvc
|
||||
pixi_env: cross-windows-arm64
|
||||
- os: windows-2025
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: ON
|
||||
target_triple: aarch64-pc-windows-msvc
|
||||
pixi_env: cross-windows-arm64
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Free Disk Space
|
||||
if: runner.os == 'Linux'
|
||||
uses: jlumbroso/free-disk-space@main
|
||||
|
||||
- name: Increase Swap Space
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
echo "===== Initial Status ====="
|
||||
sudo swapon --show
|
||||
free -h
|
||||
|
||||
echo "===== Creating Swap File ====="
|
||||
sudo swapoff -a
|
||||
sudo fallocate -l 16G /mnt/swapfile
|
||||
sudo chmod 600 /mnt/swapfile
|
||||
sudo mkswap /mnt/swapfile
|
||||
sudo swapon /mnt/swapfile
|
||||
|
||||
echo "===== Final Status ====="
|
||||
sudo swapon --show
|
||||
free -h
|
||||
df -h
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: ${{ matrix.pixi_env || 'package' }}
|
||||
|
||||
- name: Clone llvm-project
|
||||
shell: bash
|
||||
run: |
|
||||
VERSION="${{ inputs.llvm_version || '21.1.8' }}"
|
||||
echo "Cloning LLVM ${VERSION}..."
|
||||
git clone --branch "llvmorg-${VERSION}" --depth 1 https://github.com/llvm/llvm-project.git .llvm
|
||||
|
||||
- name: Validate distribution components
|
||||
shell: bash
|
||||
run: |
|
||||
python3 scripts/validate-llvm-components.py \
|
||||
--llvm-src=.llvm \
|
||||
--components-file=scripts/llvm-components.json
|
||||
|
||||
- name: Build LLVM (install-distribution)
|
||||
shell: bash
|
||||
run: |
|
||||
ENV="${{ matrix.pixi_env || 'package' }}"
|
||||
EXTRA_ARGS=""
|
||||
if [[ -n "${{ matrix.target_triple }}" ]]; then
|
||||
EXTRA_ARGS="--target-triple=${{ matrix.target_triple }}"
|
||||
fi
|
||||
pixi run -e "$ENV" build-llvm \
|
||||
--llvm-src=.llvm \
|
||||
--mode="${{ matrix.llvm_mode }}" \
|
||||
--lto="${{ matrix.lto }}" \
|
||||
--build-dir=build \
|
||||
${EXTRA_ARGS}
|
||||
|
||||
- name: Build clice using installed LLVM
|
||||
if: ${{ !matrix.target_triple }}
|
||||
shell: bash
|
||||
run: |
|
||||
pixi run cmake-config ${{ matrix.llvm_mode }} ON -- \
|
||||
"-DCLICE_ENABLE_LTO=${{ matrix.lto }}" \
|
||||
"-DLLVM_INSTALL_PATH=.llvm/build-install"
|
||||
pixi run cmake-build ${{ matrix.llvm_mode }}
|
||||
|
||||
- name: Build clice using installed LLVM (cross-compile)
|
||||
if: ${{ matrix.target_triple }}
|
||||
shell: bash
|
||||
run: |
|
||||
ENV="${{ matrix.pixi_env || 'package' }}"
|
||||
pixi run -e "$ENV" cmake-config ${{ matrix.llvm_mode }} ON -- \
|
||||
"-DCLICE_ENABLE_LTO=${{ matrix.lto }}" \
|
||||
"-DCLICE_TARGET_TRIPLE=${{ matrix.target_triple }}" \
|
||||
"-DLLVM_INSTALL_PATH=.llvm/build-install"
|
||||
pixi run -e "$ENV" cmake-build ${{ matrix.llvm_mode }}
|
||||
|
||||
- name: Verify cross-compiled binary architecture
|
||||
if: ${{ matrix.target_triple && runner.os != 'Windows' }}
|
||||
shell: bash
|
||||
run: |
|
||||
BINARY="build/${{ matrix.llvm_mode }}/bin/clice"
|
||||
echo "Binary info:"
|
||||
file "$BINARY"
|
||||
case "${{ matrix.target_triple }}" in
|
||||
aarch64-linux-gnu) file "$BINARY" | grep -q "aarch64" ;;
|
||||
x86_64-apple-darwin) file "$BINARY" | grep -q "x86_64" ;;
|
||||
esac
|
||||
|
||||
- name: Upload cross-compiled clice for functional test
|
||||
if: ${{ matrix.target_triple && matrix.lto == 'OFF' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cross-clice-${{ matrix.target_triple }}-${{ matrix.llvm_mode }}
|
||||
path: |
|
||||
build/${{ matrix.llvm_mode }}/bin/
|
||||
build/${{ matrix.llvm_mode }}/lib/
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
- name: Run tests
|
||||
if: ${{ !matrix.target_triple }}
|
||||
shell: bash
|
||||
run: pixi run test ${{ matrix.llvm_mode }}
|
||||
|
||||
# Prune is only supported for native builds (requires linking clice to test).
|
||||
# Cross-compiled targets reuse the native prune manifest of the same OS.
|
||||
- name: Prune LLVM static libraries (Debug/RelWithDebInfo no LTO)
|
||||
if: (!matrix.target_triple) && (matrix.llvm_mode == 'Debug' || (matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'OFF'))
|
||||
shell: bash
|
||||
run: |
|
||||
MANIFEST="pruned-libs-${{ matrix.os }}.json"
|
||||
echo "LLVM_PRUNED_MANIFEST=${MANIFEST}" >> "${GITHUB_ENV}"
|
||||
python3 scripts/prune-llvm-bin.py \
|
||||
--action discover \
|
||||
--install-dir ".llvm/build-install/lib" \
|
||||
--build-dir "build/${{ matrix.llvm_mode }}" \
|
||||
--max-attempts 60 \
|
||||
--sleep-seconds 60 \
|
||||
--manifest "${MANIFEST}"
|
||||
|
||||
- name: Upload pruned-libs manifest
|
||||
if: (!matrix.target_triple) && matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'OFF'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: llvm-pruned-libs-${{ matrix.os }}
|
||||
path: ${{ env.LLVM_PRUNED_MANIFEST }}
|
||||
if-no-files-found: error
|
||||
compression-level: 0
|
||||
|
||||
- name: Apply pruned-libs manifest (RelWithDebInfo + LTO, native only)
|
||||
if: (!matrix.target_triple) && matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'ON'
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
MANIFEST="pruned-libs-${{ matrix.os }}.json"
|
||||
python3 scripts/prune-llvm-bin.py \
|
||||
--action apply \
|
||||
--manifest "${MANIFEST}" \
|
||||
--install-dir ".llvm/build-install/lib" \
|
||||
--build-dir "build/${{ matrix.llvm_mode }}" \
|
||||
--gh-run-id "${{ github.run_id }}" \
|
||||
--gh-artifact "llvm-pruned-libs-${{ matrix.os }}" \
|
||||
--gh-download-dir "artifacts" \
|
||||
--max-attempts 60 \
|
||||
--sleep-seconds 60
|
||||
|
||||
# For cross-compiled LTO builds, apply the native prune manifest.
|
||||
# The unused library set is arch-independent (same API surface).
|
||||
- name: Apply pruned-libs manifest (cross-compile + LTO)
|
||||
if: matrix.target_triple && matrix.lto == 'ON'
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
MANIFEST="pruned-libs-${{ matrix.os }}.json"
|
||||
python3 scripts/prune-llvm-bin.py \
|
||||
--action apply \
|
||||
--manifest "${MANIFEST}" \
|
||||
--install-dir ".llvm/build-install/lib" \
|
||||
--build-dir "build/${{ matrix.llvm_mode }}" \
|
||||
--gh-run-id "${{ github.run_id }}" \
|
||||
--gh-artifact "llvm-pruned-libs-${{ matrix.os }}" \
|
||||
--gh-download-dir "artifacts" \
|
||||
--max-attempts 60 \
|
||||
--sleep-seconds 60
|
||||
|
||||
- name: Package LLVM install directory
|
||||
shell: bash
|
||||
run: |
|
||||
MODE_TAG="releasedbg"
|
||||
if [[ "${{ matrix.llvm_mode }}" == "Debug" ]]; then
|
||||
MODE_TAG="debug"
|
||||
fi
|
||||
|
||||
# Determine arch/platform/toolchain from target triple or runner OS
|
||||
if [[ -n "${{ matrix.target_triple }}" ]]; then
|
||||
case "${{ matrix.target_triple }}" in
|
||||
x86_64-apple-darwin)
|
||||
ARCH="x64"; PLATFORM="macos"; TOOLCHAIN="clang" ;;
|
||||
aarch64-linux-gnu)
|
||||
ARCH="aarch64"; PLATFORM="linux"; TOOLCHAIN="gnu" ;;
|
||||
aarch64-pc-windows-msvc)
|
||||
ARCH="aarch64"; PLATFORM="windows"; TOOLCHAIN="msvc" ;;
|
||||
esac
|
||||
else
|
||||
ARCH="x64"
|
||||
PLATFORM="linux"
|
||||
TOOLCHAIN="gnu"
|
||||
if [[ "${{ matrix.os }}" == windows-* ]]; then
|
||||
PLATFORM="windows"
|
||||
TOOLCHAIN="msvc"
|
||||
elif [[ "${{ matrix.os }}" == macos-* ]]; then
|
||||
ARCH="arm64"
|
||||
PLATFORM="macos"
|
||||
TOOLCHAIN="clang"
|
||||
fi
|
||||
fi
|
||||
|
||||
SUFFIX=""
|
||||
if [[ "${{ matrix.lto }}" == "ON" ]]; then
|
||||
SUFFIX="-lto"
|
||||
fi
|
||||
if [[ "${{ matrix.llvm_mode }}" == "Debug" && "${{ matrix.os }}" != windows-* ]]; then
|
||||
SUFFIX="${SUFFIX}-asan"
|
||||
fi
|
||||
|
||||
ARCHIVE="${ARCH}-${PLATFORM}-${TOOLCHAIN}-${MODE_TAG}${SUFFIX}.tar.xz"
|
||||
|
||||
set -eo pipefail
|
||||
tar -C .llvm -cf - build-install | xz -T0 -9 -c > "${ARCHIVE}"
|
||||
echo "LLVM_INSTALL_ARCHIVE=${ARCHIVE}" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: Upload LLVM install artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.LLVM_INSTALL_ARCHIVE }}
|
||||
path: ${{ env.LLVM_INSTALL_ARCHIVE }}
|
||||
if-no-files-found: error
|
||||
|
||||
test-cross:
|
||||
needs: build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: macos-15-intel
|
||||
llvm_mode: RelWithDebInfo
|
||||
target_triple: x86_64-apple-darwin
|
||||
- os: ubuntu-24.04-arm
|
||||
llvm_mode: RelWithDebInfo
|
||||
target_triple: aarch64-linux-gnu
|
||||
- os: windows-11-arm
|
||||
llvm_mode: RelWithDebInfo
|
||||
target_triple: aarch64-pc-windows-msvc
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: test-run
|
||||
|
||||
- name: Download cross-compiled clice
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: cross-clice-${{ matrix.target_triple }}-${{ matrix.llvm_mode }}
|
||||
path: build/${{ matrix.llvm_mode }}/
|
||||
|
||||
- name: Make binaries executable
|
||||
if: runner.os != 'Windows'
|
||||
run: chmod +x build/${{ matrix.llvm_mode }}/bin/*
|
||||
|
||||
- name: Run tests
|
||||
run: pixi run -e test-run test ${{ matrix.llvm_mode }}
|
||||
|
||||
upload:
|
||||
needs: build
|
||||
if: ${{ !cancelled() && inputs.llvm_version && !inputs.skip_upload }}
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download all build artifacts
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: scripts/download-llvm.sh "${{ github.run_id }}"
|
||||
|
||||
- name: Upload to clice-llvm
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.UPLOAD_LLVM }}
|
||||
TARGET_REPO: clice-io/clice-llvm
|
||||
run: python3 scripts/upload-llvm.py "${{ inputs.llvm_version }}" "${TARGET_REPO}" "${{ github.run_id }}"
|
||||
|
||||
- name: Save manifest for update-clice job
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: llvm-manifest-final
|
||||
path: artifacts/llvm-manifest.json
|
||||
if-no-files-found: error
|
||||
compression-level: 0
|
||||
|
||||
update-clice:
|
||||
needs: upload
|
||||
if: ${{ !inputs.skip_pr }}
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download manifest
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: llvm-manifest-final
|
||||
path: .
|
||||
|
||||
- name: Update manifest and version
|
||||
run: |
|
||||
python3 scripts/update-llvm-version.py \
|
||||
--version "${{ inputs.llvm_version }}" \
|
||||
--manifest-src llvm-manifest.json \
|
||||
--manifest-dest config/llvm-manifest.json \
|
||||
--package-cmake cmake/package.cmake
|
||||
|
||||
- name: Create or update PR
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
VERSION="${{ inputs.llvm_version }}"
|
||||
BRANCH="chore/update-llvm-${VERSION}"
|
||||
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
RELEASE_URL="https://github.com/clice-io/clice-llvm/releases/tag/${VERSION}"
|
||||
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git checkout -b "${BRANCH}"
|
||||
git add config/llvm-manifest.json cmake/package.cmake
|
||||
git commit -m "chore: update LLVM to ${VERSION}"
|
||||
git push --force-with-lease origin "${BRANCH}"
|
||||
|
||||
# Check if PR already exists for this branch
|
||||
EXISTING_PR=$(gh pr list --head "${BRANCH}" --json number --jq '.[0].number // empty')
|
||||
|
||||
BODY="$(cat <<EOF
|
||||
## Summary
|
||||
- Update LLVM prebuilt binaries to version ${VERSION}
|
||||
- Updated \`config/llvm-manifest.json\` with new SHA256 hashes
|
||||
- Updated \`cmake/package.cmake\` version string
|
||||
|
||||
**Artifacts:** [clice-llvm release](${RELEASE_URL})
|
||||
**Build:** [workflow run](${RUN_URL})
|
||||
|
||||
> Auto-generated by build-llvm workflow
|
||||
EOF
|
||||
)"
|
||||
|
||||
if [[ -n "${EXISTING_PR}" ]]; then
|
||||
echo "Updating existing PR #${EXISTING_PR}"
|
||||
gh pr edit "${EXISTING_PR}" --body "${BODY}"
|
||||
else
|
||||
gh pr create \
|
||||
--title "chore: update LLVM to ${VERSION}" \
|
||||
--body "${BODY}" \
|
||||
--base main
|
||||
fi
|
||||
@@ -1,40 +0,0 @@
|
||||
name: format
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
check-format:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: format
|
||||
|
||||
- name: Validate update-llvm-version.py can still patch package.cmake
|
||||
run: |
|
||||
python3 scripts/update-llvm-version.py --check \
|
||||
--manifest-dest config/llvm-manifest.json \
|
||||
--package-cmake cmake/package.cmake
|
||||
|
||||
- name: Run formatter
|
||||
run: pixi run format
|
||||
continue-on-error: true
|
||||
|
||||
- name: Auto correct
|
||||
uses: huacnlee/autocorrect-action@v2
|
||||
with:
|
||||
args: --lint ./docs
|
||||
continue-on-error: true
|
||||
|
||||
- name: Check diff
|
||||
run: |
|
||||
if ! git diff --quiet; then
|
||||
echo "::error::Formatting changes detected. Please run 'pixi run format' and commit the result."
|
||||
git --no-pager diff --stat
|
||||
git --no-pager diff
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,30 +0,0 @@
|
||||
name: deploy
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
deploy-docs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: node
|
||||
|
||||
- name: Build docs
|
||||
run: pixi run build-docs
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: peaceiris/actions-gh-pages@v4
|
||||
if: github.ref == 'refs/heads/main'
|
||||
with:
|
||||
personal_token: ${{ secrets.PUBLISH_DOCS }}
|
||||
external_repository: clice-io/docs
|
||||
publish_dir: ./docs/.vitepress/dist
|
||||
destination_dir: clice
|
||||
keep_files: true
|
||||
@@ -1,137 +0,0 @@
|
||||
name: main
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
format: ${{ steps.filter.outputs.format }}
|
||||
docs: ${{ steps.filter.outputs.docs }}
|
||||
clice: ${{ steps.filter.outputs.clice }}
|
||||
vscode: ${{ steps.filter.outputs.vscode }}
|
||||
cmake: ${{ steps.filter.outputs.cmake }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
format:
|
||||
- '**/*.{h,c,cpp,hpp,ts,js,lua,md,yml,yaml}'
|
||||
docs:
|
||||
- 'docs/**'
|
||||
- '.github/workflows/deploy-docs.yml'
|
||||
clice:
|
||||
- 'src/**'
|
||||
- 'include/**'
|
||||
- 'CMakeLists.txt'
|
||||
- '.github/workflows/publish-clice.yml'
|
||||
vscode:
|
||||
- 'editors/vscode/**'
|
||||
- '.github/workflows/publish-vscode.yml'
|
||||
cmake:
|
||||
- 'CMakeLists.txt'
|
||||
- 'src/**'
|
||||
- 'include/**'
|
||||
- 'tests/**'
|
||||
- 'config/**'
|
||||
- '.github/workflows/test-cmake.yml'
|
||||
|
||||
conventional-commit:
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check conventional commit format
|
||||
env:
|
||||
IS_PR: ${{ github.event_name == 'pull_request' }}
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
COMMIT_MSG: ${{ github.event.head_commit.message }}
|
||||
run: |
|
||||
pattern='^(feat|fix|refactor|chore|build|ci|docs|test|perf|style|revert)(\(.+\))?: .+'
|
||||
if [[ "$IS_PR" == "true" ]]; then
|
||||
subject="$PR_TITLE"
|
||||
label="PR title"
|
||||
else
|
||||
subject=$(echo "$COMMIT_MSG" | head -n1)
|
||||
label="Commit message"
|
||||
fi
|
||||
if [[ ! "$subject" =~ $pattern ]]; then
|
||||
echo "::error::$label must follow conventional commit format: type(scope)?: description"
|
||||
echo " Valid types: feat, fix, refactor, chore, build, ci, docs, test, perf, style, revert"
|
||||
echo " Got: '$subject'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
format:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.format == 'true' }}
|
||||
uses: ./.github/workflows/check-format.yml
|
||||
|
||||
deploy:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.docs == 'true' }}
|
||||
permissions:
|
||||
contents: write
|
||||
uses: ./.github/workflows/deploy-docs.yml
|
||||
secrets: inherit
|
||||
|
||||
# clice:
|
||||
# needs: changes
|
||||
# if: ${{ needs.changes.outputs.clice == 'true' }}
|
||||
# uses: ./.github/workflows/publish-clice.yml
|
||||
|
||||
vscode:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.vscode == 'true' }}
|
||||
uses: ./.github/workflows/publish-vscode.yml
|
||||
|
||||
cmake:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.cmake == 'true' }}
|
||||
uses: ./.github/workflows/test-cmake.yml
|
||||
|
||||
release-clice:
|
||||
permissions:
|
||||
contents: write
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: ./.github/workflows/publish-clice.yml
|
||||
secrets: inherit
|
||||
|
||||
release-vscode:
|
||||
permissions:
|
||||
contents: write
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: ./.github/workflows/publish-vscode.yml
|
||||
secrets: inherit
|
||||
|
||||
checks-passed:
|
||||
if: ${{ always() && !startsWith(github.ref, 'refs/tags/') }}
|
||||
needs:
|
||||
- conventional-commit
|
||||
- format
|
||||
- deploy
|
||||
# - clice
|
||||
- vscode
|
||||
- cmake
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check results
|
||||
uses: re-actors/alls-green@release/v1
|
||||
with:
|
||||
allowed-skips: conventional-commit,format,deploy,clice,vscode,cmake
|
||||
jobs: ${{ toJSON(needs) }}
|
||||
@@ -1,100 +0,0 @@
|
||||
name: clice
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
publish-clice:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# Native builds
|
||||
- os: windows-2025
|
||||
artifact_name: clice.zip
|
||||
asset_name: clice-x64-windows-msvc.zip
|
||||
symbol_artifact_name: clice-symbol.zip
|
||||
symbol_asset_name: clice-x64-windows-msvc-symbol.zip
|
||||
|
||||
- os: ubuntu-24.04
|
||||
artifact_name: clice.tar.gz
|
||||
asset_name: clice-x86_64-linux-gnu.tar.gz
|
||||
symbol_artifact_name: clice-symbol.tar.gz
|
||||
symbol_asset_name: clice-x86_64-linux-gnu-symbol.tar.gz
|
||||
|
||||
- os: macos-15
|
||||
artifact_name: clice.tar.gz
|
||||
asset_name: clice-arm64-macos-darwin.tar.gz
|
||||
symbol_artifact_name: clice-symbol.tar.gz
|
||||
symbol_asset_name: clice-arm64-macos-darwin-symbol.tar.gz
|
||||
|
||||
# Cross-compilation builds
|
||||
- os: macos-15
|
||||
target_triple: x86_64-apple-darwin
|
||||
pixi_env: cross-macos-x64
|
||||
artifact_name: clice.tar.gz
|
||||
asset_name: clice-x86_64-macos-darwin.tar.gz
|
||||
symbol_artifact_name: clice-symbol.tar.gz
|
||||
symbol_asset_name: clice-x86_64-macos-darwin-symbol.tar.gz
|
||||
|
||||
- os: ubuntu-24.04
|
||||
target_triple: aarch64-linux-gnu
|
||||
pixi_env: cross-linux-aarch64
|
||||
artifact_name: clice.tar.gz
|
||||
asset_name: clice-aarch64-linux-gnu.tar.gz
|
||||
symbol_artifact_name: clice-symbol.tar.gz
|
||||
symbol_asset_name: clice-aarch64-linux-gnu-symbol.tar.gz
|
||||
|
||||
- os: windows-2025
|
||||
target_triple: aarch64-pc-windows-msvc
|
||||
pixi_env: cross-windows-arm64
|
||||
artifact_name: clice.zip
|
||||
asset_name: clice-aarch64-windows-msvc.zip
|
||||
symbol_artifact_name: clice-symbol.zip
|
||||
symbol_asset_name: clice-aarch64-windows-msvc-symbol.zip
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: ${{ matrix.pixi_env || 'package' }}
|
||||
|
||||
- name: Package (native)
|
||||
if: ${{ !matrix.target_triple }}
|
||||
run: pixi run package
|
||||
|
||||
- name: Package (cross-compile)
|
||||
if: ${{ matrix.target_triple }}
|
||||
run: |
|
||||
ENV="${{ matrix.pixi_env }}"
|
||||
pixi run -e "$ENV" package-config -- \
|
||||
"-DCLICE_TARGET_TRIPLE=${{ matrix.target_triple }}"
|
||||
pixi run -e "$ENV" cmake-build
|
||||
|
||||
- name: Upload Main Package to Release
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: build/RelWithDebInfo/${{ matrix.artifact_name }}
|
||||
asset_name: ${{ matrix.asset_name }}
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
|
||||
- name: Upload Symbol Package to Release
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: build/RelWithDebInfo/${{ matrix.symbol_artifact_name }}
|
||||
asset_name: ${{ matrix.symbol_asset_name }}
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
@@ -1,38 +0,0 @@
|
||||
name: vscode
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
publish-vscode:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: editors/vscode
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: node
|
||||
|
||||
- name: Publish and Package to Marketplace
|
||||
env:
|
||||
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
||||
run: |
|
||||
FLAG="${{ contains(github.ref_name, '-') && '--pre-release' || '' }}"
|
||||
pixi run build-vscode $FLAG
|
||||
|
||||
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
|
||||
pixi run publish-vscode -p "$VSCE_PAT" $FLAG
|
||||
fi
|
||||
|
||||
- name: Upload .vsix to Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
with:
|
||||
files: "editors/vscode/*.vsix"
|
||||
tag_name: ${{ github.ref }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,170 +0,0 @@
|
||||
name: cmake
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.cache/ccache
|
||||
SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache
|
||||
CCACHE_BASEDIR: ${{ github.workspace }}
|
||||
SCCACHE_BASEDIRS: ${{ github.workspace }}
|
||||
CCACHE_COMPILERCHECK: content
|
||||
CCACHE_MAXSIZE: 2G
|
||||
SCCACHE_CACHE_SIZE: 2G
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# Native builds
|
||||
- os: windows-2025
|
||||
build_type: RelWithDebInfo
|
||||
- os: ubuntu-24.04
|
||||
build_type: Debug
|
||||
- os: ubuntu-24.04
|
||||
build_type: RelWithDebInfo
|
||||
- os: macos-15
|
||||
build_type: Debug
|
||||
- os: macos-15
|
||||
build_type: RelWithDebInfo
|
||||
# Cross-compile (build only; tests run on native runners)
|
||||
- os: macos-15
|
||||
build_type: RelWithDebInfo
|
||||
target_triple: x86_64-apple-darwin
|
||||
build_only: true
|
||||
- os: ubuntu-24.04
|
||||
build_type: RelWithDebInfo
|
||||
target_triple: aarch64-linux-gnu
|
||||
build_only: true
|
||||
pixi_env: cross-linux-aarch64
|
||||
- os: windows-2025
|
||||
build_type: RelWithDebInfo
|
||||
target_triple: aarch64-pc-windows-msvc
|
||||
build_only: true
|
||||
pixi_env: cross-windows-arm64
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: ${{ matrix.pixi_env || 'default' }}
|
||||
|
||||
- name: Restore compiler cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ runner.os == 'Windows' && '.cache/sccache' || '.cache/ccache' }}
|
||||
key: ${{ runner.os }}-${{ matrix.build_type }}-${{ matrix.target_triple || 'native' }}-ccache-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ matrix.build_type }}-${{ matrix.target_triple || 'native' }}-ccache-
|
||||
|
||||
- name: Zero cache stats
|
||||
run: |
|
||||
ENV="${{ matrix.pixi_env || 'default' }}"
|
||||
if [ "$RUNNER_OS" = "Windows" ]; then
|
||||
pixi run -e "$ENV" -- sccache --stop-server || true
|
||||
pixi run -e "$ENV" -- sccache --zero-stats || true
|
||||
else
|
||||
pixi run -e "$ENV" -- ccache --zero-stats || true
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Build (native)
|
||||
if: ${{ !matrix.target_triple }}
|
||||
run: pixi run build ${{ matrix.build_type }} ON
|
||||
|
||||
- name: Build (cross-compile)
|
||||
if: ${{ matrix.target_triple }}
|
||||
shell: bash
|
||||
run: |
|
||||
ENV="${{ matrix.pixi_env || 'default' }}"
|
||||
pixi run -e "$ENV" cmake-config ${{ matrix.build_type }} OFF -- \
|
||||
"-DCLICE_TARGET_TRIPLE=${{ matrix.target_triple }}"
|
||||
pixi run -e "$ENV" cmake-build ${{ matrix.build_type }}
|
||||
|
||||
- name: Upload cross-compiled binaries
|
||||
if: ${{ matrix.build_only }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cross-build-${{ matrix.target_triple }}
|
||||
path: |
|
||||
build/${{ matrix.build_type }}/bin/
|
||||
build/${{ matrix.build_type }}/lib/
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
- name: Unit tests
|
||||
if: ${{ !matrix.build_only }}
|
||||
timeout-minutes: 5
|
||||
run: pixi run unit-test ${{ matrix.build_type }}
|
||||
|
||||
- name: Integration tests
|
||||
if: ${{ !matrix.build_only }}
|
||||
timeout-minutes: 20
|
||||
run: pixi run integration-test ${{ matrix.build_type }}
|
||||
|
||||
- name: Smoke tests
|
||||
if: ${{ !matrix.build_only }}
|
||||
timeout-minutes: 15
|
||||
run: pixi run smoke-test ${{ matrix.build_type }}
|
||||
|
||||
- name: Print cache stats and stop server
|
||||
if: always()
|
||||
run: |
|
||||
ENV="${{ matrix.pixi_env || 'default' }}"
|
||||
if [ "$RUNNER_OS" = "Windows" ]; then
|
||||
pixi run -e "$ENV" -- sccache --show-stats
|
||||
pixi run -e "$ENV" -- sccache --stop-server || true
|
||||
else
|
||||
pixi run -e "$ENV" -- ccache --show-stats
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
test-cross:
|
||||
needs: build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: macos-15-intel
|
||||
build_type: RelWithDebInfo
|
||||
target_triple: x86_64-apple-darwin
|
||||
- os: ubuntu-24.04-arm
|
||||
build_type: RelWithDebInfo
|
||||
target_triple: aarch64-linux-gnu
|
||||
- os: windows-11-arm
|
||||
build_type: RelWithDebInfo
|
||||
target_triple: aarch64-pc-windows-msvc
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: test-run
|
||||
|
||||
- name: Download cross-compiled binaries
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: cross-build-${{ matrix.target_triple }}
|
||||
path: build/${{ matrix.build_type }}/
|
||||
|
||||
- name: Make binaries executable
|
||||
if: runner.os != 'Windows'
|
||||
run: chmod +x build/${{ matrix.build_type }}/bin/*
|
||||
|
||||
- name: Unit tests
|
||||
timeout-minutes: 5
|
||||
run: pixi run -e test-run unit-test ${{ matrix.build_type }}
|
||||
|
||||
- name: Integration tests
|
||||
timeout-minutes: 20
|
||||
run: pixi run -e test-run integration-test ${{ matrix.build_type }}
|
||||
|
||||
- name: Smoke tests
|
||||
timeout-minutes: 10
|
||||
run: pixi run -e test-run smoke-test ${{ matrix.build_type }}
|
||||
@@ -1,38 +0,0 @@
|
||||
name: upload-llvm
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
# if you want to run this workflow, change the branch name to main,
|
||||
# if you want to turn off it, change it to non existent branch.
|
||||
branches: [main-turn-off]
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
workflow_id:
|
||||
description: "Workflow run ID to pull artifacts from"
|
||||
required: true
|
||||
type: string
|
||||
version:
|
||||
description: "Release version/tag to publish (e.g., v1.2.3)"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download artifacts from workflow
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: scripts/download-llvm.sh "${{ inputs.workflow_id }}"
|
||||
|
||||
- name: Recreate release with artifacts
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.UPLOAD_LLVM }}
|
||||
TARGET_REPO: clice-io/clice-llvm
|
||||
run: python3 scripts/upload-llvm.py "${{ inputs.version }}" "${TARGET_REPO}" "${{ inputs.workflow_id }}"
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -68,7 +68,8 @@ tests/unit/Local/
|
||||
.pixi/*
|
||||
!.pixi/config.toml
|
||||
|
||||
.codex
|
||||
.codex/
|
||||
.claude/*
|
||||
!.claude/CLAUDE.md
|
||||
!.claude/commands/
|
||||
openspec/
|
||||
|
||||
@@ -34,34 +34,6 @@ bool is_dependent(const clang::Decl* D) {
|
||||
return isa<clang::UnresolvedUsingValueDecl>(D);
|
||||
}
|
||||
|
||||
/// Whether a declaration name is backed by source text that should be highlighted.
|
||||
bool can_highlight_name(clang::DeclarationName name) {
|
||||
switch(name.getNameKind()) {
|
||||
case clang::DeclarationName::Identifier: {
|
||||
auto* info = name.getAsIdentifierInfo();
|
||||
return info && !info->getName().empty();
|
||||
}
|
||||
|
||||
case clang::DeclarationName::CXXConstructorName:
|
||||
case clang::DeclarationName::CXXDestructorName: {
|
||||
return true;
|
||||
}
|
||||
|
||||
case clang::DeclarationName::CXXConversionFunctionName:
|
||||
case clang::DeclarationName::CXXOperatorName:
|
||||
case clang::DeclarationName::CXXDeductionGuideName:
|
||||
case clang::DeclarationName::CXXLiteralOperatorName:
|
||||
case clang::DeclarationName::CXXUsingDirective:
|
||||
case clang::DeclarationName::ObjCZeroArgSelector:
|
||||
case clang::DeclarationName::ObjCOneArgSelector:
|
||||
case clang::DeclarationName::ObjCMultiArgSelector: {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
std::unreachable();
|
||||
}
|
||||
|
||||
/// Returns true if `decl` is considered to be from a default/system library.
|
||||
/// This currently checks the systemness of the file by include type, although
|
||||
/// different heuristics may be used in the future (e.g. sysroot paths).
|
||||
@@ -199,10 +171,6 @@ public:
|
||||
void handleDeclOccurrence(const clang::NamedDecl* decl,
|
||||
RelationKind relation,
|
||||
clang::SourceLocation location) {
|
||||
if(relation.isReference() && !can_highlight_name(decl->getDeclName())) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::uint32_t modifiers = 0;
|
||||
if(relation.is_one_of(RelationKind::Definition)) {
|
||||
// todo: clangd add both Declaration and Definition modifiers for definitions.
|
||||
|
||||
@@ -778,9 +778,10 @@ AgentClient::AgentClient(MasterServer& server, kota::ipc::JsonPeer& peer) :
|
||||
co_return result;
|
||||
});
|
||||
|
||||
peer.on_notification([&srv](const ShutdownParams&) {
|
||||
peer.on_notification([this, &srv](const ShutdownParams&) {
|
||||
LOG_INFO("agentic/shutdown received, shutting down");
|
||||
srv.schedule_shutdown();
|
||||
this->peer.close();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +156,7 @@ LSPClient::LSPClient(MasterServer& server, kota::ipc::JsonPeer& peer) : server(s
|
||||
peer.on_notification([this]([[maybe_unused]] const protocol::ExitParams& params) {
|
||||
LOG_INFO("Exit notification received");
|
||||
this->server.schedule_shutdown();
|
||||
this->peer.close();
|
||||
});
|
||||
|
||||
peer.on_notification([this](const protocol::DidOpenTextDocumentParams& params) {
|
||||
|
||||
@@ -110,14 +110,14 @@ void MasterServer::start_file_watcher() {
|
||||
if(workspace_root.empty())
|
||||
return;
|
||||
|
||||
loop.schedule([this]() -> kota::task<> {
|
||||
auto watcher = kota::fs_event::create(workspace_root, {}, loop);
|
||||
loop.schedule([](MasterServer& server) -> kota::task<> {
|
||||
auto watcher = kota::fs_event::create(server.workspace_root, {}, server.loop);
|
||||
if(!watcher) {
|
||||
LOG_WARN("Failed to start file watcher for {}", workspace_root);
|
||||
LOG_WARN("Failed to start file watcher for {}", server.workspace_root);
|
||||
co_return;
|
||||
}
|
||||
|
||||
LOG_INFO("File watcher started for {}", workspace_root);
|
||||
LOG_INFO("File watcher started for {}", server.workspace_root);
|
||||
|
||||
while(true) {
|
||||
auto changes = co_await watcher->next();
|
||||
@@ -132,19 +132,19 @@ void MasterServer::start_file_watcher() {
|
||||
llvm::StringRef file(change.path);
|
||||
if(file.ends_with("compile_commands.json")) {
|
||||
LOG_INFO("CDB changed, reloading workspace");
|
||||
load_workspace();
|
||||
server.load_workspace();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(file.ends_with(".cpp") || file.ends_with(".cc") || file.ends_with(".cxx") ||
|
||||
file.ends_with(".c") || file.ends_with(".h") || file.ends_with(".hpp") ||
|
||||
file.ends_with(".hxx") || file.ends_with(".cppm") || file.ends_with(".ixx")) {
|
||||
auto path_id = workspace.path_pool.intern(file);
|
||||
on_file_saved(path_id);
|
||||
auto path_id = server.workspace.path_pool.intern(file);
|
||||
server.on_file_saved(path_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}());
|
||||
}(*this));
|
||||
}
|
||||
|
||||
Session* MasterServer::find_session(std::uint32_t path_id) {
|
||||
@@ -212,10 +212,10 @@ void MasterServer::schedule_shutdown() {
|
||||
workspace.save_cache();
|
||||
shutdown_event.set();
|
||||
|
||||
loop.schedule([this]() -> kota::task<> {
|
||||
co_await kota::when_all(indexer.stop(), compiler.stop(), pool.stop());
|
||||
loop.stop();
|
||||
}());
|
||||
loop.schedule([](MasterServer& server) -> kota::task<> {
|
||||
co_await kota::when_all(server.indexer.stop(), server.compiler.stop(), server.pool.stop());
|
||||
server.loop.stop();
|
||||
}(*this));
|
||||
}
|
||||
|
||||
void MasterServer::load_workspace() {
|
||||
@@ -355,35 +355,53 @@ static kota::task<> accept_connections(MasterServer& server,
|
||||
std::list<Connection>& connections) {
|
||||
auto& loop = kota::event_loop::current();
|
||||
kota::task_group<> connection_group(loop);
|
||||
bool lsp_registered = false;
|
||||
|
||||
while(true) {
|
||||
auto conn = co_await acceptor.accept();
|
||||
if(!conn.has_value())
|
||||
break;
|
||||
co_await kota::when_all(
|
||||
[](MasterServer& server,
|
||||
kota::tcp::acceptor& acceptor,
|
||||
bool register_lsp,
|
||||
std::list<Connection>& connections,
|
||||
kota::task_group<>& connection_group) -> kota::task<> {
|
||||
auto& loop = kota::event_loop::current();
|
||||
bool lsp_registered = false;
|
||||
|
||||
LOG_INFO("Client connected");
|
||||
while(true) {
|
||||
auto conn = co_await acceptor.accept();
|
||||
if(!conn.has_value())
|
||||
break;
|
||||
|
||||
auto transport = std::make_unique<kota::ipc::StreamTransport>(std::move(*conn));
|
||||
auto peer = std::make_unique<kota::ipc::JsonPeer>(loop, std::move(transport));
|
||||
LOG_INFO("Client connected");
|
||||
|
||||
std::unique_ptr<LSPClient> lsp;
|
||||
if(register_lsp && !lsp_registered) {
|
||||
lsp = std::make_unique<LSPClient>(server, *peer);
|
||||
lsp_registered = true;
|
||||
}
|
||||
auto agent = std::make_unique<AgentClient>(server, *peer);
|
||||
auto transport = std::make_unique<kota::ipc::StreamTransport>(std::move(*conn));
|
||||
auto peer = std::make_unique<kota::ipc::JsonPeer>(loop, std::move(transport));
|
||||
|
||||
auto* peer_ptr = peer.get();
|
||||
auto it = connections.emplace(connections.end(),
|
||||
Connection{
|
||||
.peer = std::move(peer),
|
||||
.lsp_client = std::move(lsp),
|
||||
.agent_client = std::move(agent),
|
||||
});
|
||||
std::unique_ptr<LSPClient> lsp;
|
||||
if(register_lsp && !lsp_registered) {
|
||||
lsp = std::make_unique<LSPClient>(server, *peer);
|
||||
lsp_registered = true;
|
||||
}
|
||||
auto agent = std::make_unique<AgentClient>(server, *peer);
|
||||
|
||||
connection_group.spawn(run_connection(peer_ptr, connections, it));
|
||||
}
|
||||
auto* peer_ptr = peer.get();
|
||||
auto it = connections.emplace(connections.end(),
|
||||
Connection{
|
||||
.peer = std::move(peer),
|
||||
.lsp_client = std::move(lsp),
|
||||
.agent_client = std::move(agent),
|
||||
});
|
||||
|
||||
connection_group.spawn(run_connection(peer_ptr, connections, it));
|
||||
}
|
||||
}(server, acceptor, register_lsp, connections, connection_group),
|
||||
[](MasterServer& server,
|
||||
kota::tcp::acceptor& acceptor,
|
||||
std::list<Connection>& connections) -> kota::task<> {
|
||||
co_await server.get_shutdown_event().wait();
|
||||
acceptor.stop();
|
||||
for(auto& conn: connections) {
|
||||
conn.peer->close();
|
||||
}
|
||||
}(server, acceptor, connections));
|
||||
|
||||
co_await connection_group.join();
|
||||
}
|
||||
@@ -411,18 +429,50 @@ int run_server_mode(const ServerOptions& opts) {
|
||||
|
||||
kota::ipc::JsonPeer lsp_peer(loop, std::move(final_transport));
|
||||
LSPClient lsp_client(server, lsp_peer);
|
||||
loop.schedule([](MasterServer& server, kota::ipc::JsonPeer& peer) -> kota::task<> {
|
||||
co_await server.get_shutdown_event().wait();
|
||||
peer.close();
|
||||
}(server, lsp_peer));
|
||||
|
||||
kota::tcp::acceptor agent_acceptor;
|
||||
bool has_agent_acceptor = false;
|
||||
|
||||
if(opts.port > 0) {
|
||||
auto acceptor = kota::tcp::listen(opts.host, opts.port, {}, loop);
|
||||
if(acceptor) {
|
||||
LOG_INFO("Agentic protocol listening on {}:{}", opts.host, opts.port);
|
||||
loop.schedule(accept_connections(server, std::move(*acceptor), false, connections));
|
||||
agent_acceptor = std::move(*acceptor);
|
||||
has_agent_acceptor = true;
|
||||
} else {
|
||||
LOG_WARN("Failed to start agentic listener on {}:{}", opts.host, opts.port);
|
||||
}
|
||||
}
|
||||
|
||||
loop.schedule(lsp_peer.run());
|
||||
loop.schedule([](MasterServer& server,
|
||||
kota::ipc::JsonPeer& peer,
|
||||
std::list<Connection>& connections,
|
||||
kota::tcp::acceptor acceptor,
|
||||
bool has_acceptor) -> kota::task<> {
|
||||
auto run_peer = [](MasterServer& server, kota::ipc::JsonPeer& peer) -> kota::task<> {
|
||||
co_await peer.run();
|
||||
server.schedule_shutdown();
|
||||
};
|
||||
auto close_peer_on_shutdown = [](MasterServer& server,
|
||||
kota::ipc::JsonPeer& peer) -> kota::task<> {
|
||||
co_await server.get_shutdown_event().wait();
|
||||
peer.close();
|
||||
};
|
||||
|
||||
if(has_acceptor) {
|
||||
co_await kota::when_all(
|
||||
run_peer(server, peer),
|
||||
close_peer_on_shutdown(server, peer),
|
||||
accept_connections(server, std::move(acceptor), false, connections));
|
||||
} else {
|
||||
co_await kota::when_all(run_peer(server, peer),
|
||||
close_peer_on_shutdown(server, peer));
|
||||
}
|
||||
}(server, lsp_peer, connections, std::move(agent_acceptor), has_agent_acceptor));
|
||||
loop.run();
|
||||
return 0;
|
||||
}
|
||||
@@ -463,7 +513,12 @@ static kota::task<> daemon_main(MasterServer& server, kota::pipe::acceptor accep
|
||||
kota::task_group<> connection_group(loop);
|
||||
|
||||
co_await kota::when_all(
|
||||
[&]() -> kota::task<> {
|
||||
[](MasterServer& server,
|
||||
kota::pipe::acceptor& acceptor,
|
||||
std::list<DaemonConnection>& connections,
|
||||
kota::task_group<>& connection_group) -> kota::task<> {
|
||||
auto& loop = kota::event_loop::current();
|
||||
|
||||
while(true) {
|
||||
auto conn = co_await acceptor.accept();
|
||||
if(!conn.has_value())
|
||||
@@ -484,14 +539,16 @@ static kota::task<> daemon_main(MasterServer& server, kota::pipe::acceptor accep
|
||||
|
||||
connection_group.spawn(run_daemon_connection(peer_ptr, connections, it));
|
||||
}
|
||||
}(),
|
||||
[&]() -> kota::task<> {
|
||||
}(server, acceptor, connections, connection_group),
|
||||
[](MasterServer& server,
|
||||
kota::pipe::acceptor& acceptor,
|
||||
std::list<DaemonConnection>& connections) -> kota::task<> {
|
||||
co_await server.get_shutdown_event().wait();
|
||||
acceptor.stop();
|
||||
for(auto& conn: connections) {
|
||||
conn.peer->close();
|
||||
}
|
||||
}());
|
||||
}(server, acceptor, connections));
|
||||
|
||||
co_await connection_group.join();
|
||||
}
|
||||
|
||||
@@ -116,6 +116,9 @@ bool WorkerPool::start(const WorkerPoolOptions& options) {
|
||||
options_ = options;
|
||||
log_dir_ = options.log_dir;
|
||||
|
||||
stateless_workers.reserve(options.stateless_count);
|
||||
stateful_workers.reserve(options.stateful_count);
|
||||
|
||||
for(std::uint32_t i = 0; i < options.stateless_count; ++i) {
|
||||
if(!spawn_worker(options.self_path, false, 0)) {
|
||||
return false;
|
||||
@@ -229,10 +232,10 @@ void WorkerPool::clear_owner(std::size_t worker_index) {
|
||||
|
||||
kota::task<> WorkerPool::monitor_worker(std::size_t index, bool stateful) {
|
||||
auto& workers = stateful ? stateful_workers : stateless_workers;
|
||||
auto& w = workers[index];
|
||||
auto name = std::string(stateful ? "SF-" : "SL-") + std::to_string(index);
|
||||
|
||||
auto result = co_await w.proc.wait();
|
||||
auto result = co_await workers[index].proc.wait();
|
||||
auto& w = workers[index];
|
||||
w.alive = false;
|
||||
|
||||
if(shutting_down_)
|
||||
|
||||
@@ -185,44 +185,94 @@ async def make_client(executable: Path, workspace: Path) -> CliceClient:
|
||||
return c
|
||||
|
||||
|
||||
SANITIZER_MARKERS = (
|
||||
"AddressSanitizer",
|
||||
"LeakSanitizer",
|
||||
"MemorySanitizer",
|
||||
"ThreadSanitizer",
|
||||
"UndefinedBehaviorSanitizer",
|
||||
"==ERROR:",
|
||||
"runtime error:",
|
||||
)
|
||||
|
||||
|
||||
def _server_stderr_excerpt(stderr_text: str) -> str:
|
||||
interesting = [
|
||||
line
|
||||
for line in stderr_text.splitlines()
|
||||
if "[warn]" in line
|
||||
or "[error]" in line
|
||||
or "Sanitizer" in line
|
||||
or "==ERROR:" in line
|
||||
or "runtime error:" in line
|
||||
]
|
||||
return "\n".join(interesting[-80:])
|
||||
|
||||
|
||||
async def assert_server_exited_cleanly(server, timeout: float = 3.0) -> None:
|
||||
failures: list[str] = []
|
||||
|
||||
if server is None:
|
||||
return
|
||||
|
||||
if server.returncode is None:
|
||||
try:
|
||||
await asyncio.wait_for(server.wait(), timeout=timeout)
|
||||
except asyncio.TimeoutError:
|
||||
server.kill()
|
||||
await server.wait()
|
||||
failures.append(f"server did not exit within {timeout:g}s after shutdown")
|
||||
|
||||
print(f"[server] exit code: {server.returncode}", flush=True)
|
||||
|
||||
stderr_text = ""
|
||||
if server.stderr:
|
||||
try:
|
||||
stderr_data = await asyncio.wait_for(server.stderr.read(), timeout=2.0)
|
||||
stderr_text = stderr_data.decode("utf-8", errors="replace")
|
||||
except Exception as exc:
|
||||
failures.append(f"failed to collect server stderr: {exc!r}")
|
||||
|
||||
for line in _server_stderr_excerpt(stderr_text).splitlines():
|
||||
print(f"[server] {line}", flush=True)
|
||||
|
||||
if server.returncode != 0:
|
||||
failures.append(f"server exited with code {server.returncode}")
|
||||
|
||||
if any(marker in stderr_text for marker in SANITIZER_MARKERS):
|
||||
failures.append("server stderr contains sanitizer/runtime error output")
|
||||
|
||||
if failures:
|
||||
excerpt = _server_stderr_excerpt(stderr_text)
|
||||
if excerpt:
|
||||
failures.append("server stderr excerpt:\n" + excerpt)
|
||||
pytest.fail("\n".join(failures))
|
||||
|
||||
|
||||
async def _shutdown_client(c: CliceClient) -> None:
|
||||
"""Gracefully shut down a client, force-kill if needed."""
|
||||
server = getattr(c, "_server", None)
|
||||
|
||||
try:
|
||||
await asyncio.wait_for(c.shutdown_async(None), timeout=3.0)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
c.exit(None)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
await asyncio.sleep(0.3)
|
||||
if hasattr(c, "_server") and c._server is not None and c._server.returncode is None:
|
||||
c._server.kill()
|
||||
|
||||
try:
|
||||
server = getattr(c, "_server", None)
|
||||
if server:
|
||||
if server.returncode is not None:
|
||||
print(f"[server] exit code: {server.returncode}", flush=True)
|
||||
if server.stderr:
|
||||
stderr_data = await asyncio.wait_for(server.stderr.read(), timeout=2.0)
|
||||
if stderr_data:
|
||||
for line in stderr_data.decode(
|
||||
"utf-8", errors="replace"
|
||||
).splitlines():
|
||||
if "[warn]" in line or "[error]" in line or "Sanitizer" in line:
|
||||
print(f"[server] {line}", flush=True)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
c._stop_event.set()
|
||||
for task in c._async_tasks:
|
||||
task.cancel()
|
||||
await asyncio.sleep(0.1)
|
||||
except Exception:
|
||||
pass
|
||||
await assert_server_exited_cleanly(server)
|
||||
finally:
|
||||
try:
|
||||
c._stop_event.set()
|
||||
for task in c._async_tasks:
|
||||
task.cancel()
|
||||
await asyncio.sleep(0.1)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
shutdown_client = _shutdown_client # Public alias for multi-session tests
|
||||
|
||||
@@ -530,7 +530,7 @@ async def test_rpc_impact_analysis_unknown(indexed_agentic, workspace):
|
||||
async def test_shutdown_during_indexing(executable, tmp_path):
|
||||
"""Shutdown during active background indexing must exit cleanly."""
|
||||
from tests.integration.utils.client import CliceClient
|
||||
from tests.conftest import _find_free_port
|
||||
from tests.conftest import _find_free_port, assert_server_exited_cleanly
|
||||
|
||||
workspace = tmp_path / "ws"
|
||||
workspace.mkdir()
|
||||
@@ -560,33 +560,38 @@ async def test_shutdown_during_indexing(executable, tmp_path):
|
||||
c = CliceClient()
|
||||
await c.start_io(*cmd)
|
||||
|
||||
init_options = {
|
||||
"project": {
|
||||
"cache_dir": str(workspace / ".clice"),
|
||||
"idle_timeout_ms": 0,
|
||||
}
|
||||
}
|
||||
await c.initialize(workspace, initialization_options=init_options)
|
||||
|
||||
# Give indexing a moment to start, then send shutdown
|
||||
await asyncio.sleep(0.5)
|
||||
|
||||
rpc = AgenticRpcClient(host, port)
|
||||
body = json.dumps({"jsonrpc": "2.0", "method": "agentic/shutdown", "params": {}})
|
||||
rpc.sock.sendall(f"Content-Length: {len(body)}\r\n\r\n{body}".encode())
|
||||
rpc.sock.settimeout(5)
|
||||
try:
|
||||
rpc.sock.recv(4096)
|
||||
except (socket.timeout, OSError):
|
||||
pass
|
||||
rpc.sock.close()
|
||||
init_options = {
|
||||
"project": {
|
||||
"cache_dir": str(workspace / ".clice"),
|
||||
"idle_timeout_ms": 0,
|
||||
}
|
||||
}
|
||||
try:
|
||||
await c.initialize(workspace, initialization_options=init_options)
|
||||
except Exception:
|
||||
if c._server.returncode is not None:
|
||||
await assert_server_exited_cleanly(c._server, timeout=15.0)
|
||||
raise
|
||||
|
||||
for _ in range(30):
|
||||
if c._server.returncode is not None:
|
||||
break
|
||||
# Give indexing a moment to start, then send shutdown
|
||||
await asyncio.sleep(0.5)
|
||||
|
||||
assert c._server.returncode is not None, "Server did not exit after shutdown"
|
||||
assert c._server.returncode >= 0, (
|
||||
f"Server crashed with signal {-c._server.returncode}"
|
||||
)
|
||||
rpc = AgenticRpcClient(host, port)
|
||||
body = json.dumps(
|
||||
{"jsonrpc": "2.0", "method": "agentic/shutdown", "params": {}}
|
||||
)
|
||||
rpc.sock.sendall(f"Content-Length: {len(body)}\r\n\r\n{body}".encode())
|
||||
rpc.sock.settimeout(5)
|
||||
try:
|
||||
rpc.sock.recv(4096)
|
||||
except (socket.timeout, OSError):
|
||||
pass
|
||||
rpc.sock.close()
|
||||
|
||||
await assert_server_exited_cleanly(c._server, timeout=15.0)
|
||||
finally:
|
||||
c._stop_event.set()
|
||||
for task in c._async_tasks:
|
||||
task.cancel()
|
||||
await asyncio.sleep(0.1)
|
||||
|
||||
@@ -140,10 +140,6 @@ void EXPECT_TOKEN(llvm::StringRef name,
|
||||
ASSERT_EQ(token->modifiers, expected_modifiers);
|
||||
}
|
||||
|
||||
void EXPECT_NO_TOKEN(llvm::StringRef name) {
|
||||
ASSERT_TRUE(find_by_range(name) == nullptr);
|
||||
}
|
||||
|
||||
TEST_CASE(BasicLexicalKinds) {
|
||||
run_utf8(R"cpp(
|
||||
@d1[#define] @m0[FOO]
|
||||
@@ -270,44 +266,6 @@ int main() {
|
||||
EXPECT_TOKEN("x3", SymbolKind::Variable, 0);
|
||||
}
|
||||
|
||||
TEST_CASE(IneligibleOperatorReferenceIsSuppressed) {
|
||||
run_utf8(R"cpp(
|
||||
struct S {};
|
||||
|
||||
S operator+(S lhs, S rhs);
|
||||
|
||||
void use(S lhs, S rhs) {
|
||||
(void)(lhs @plus[+] rhs);
|
||||
}
|
||||
)cpp");
|
||||
|
||||
EXPECT_NO_TOKEN("plus");
|
||||
}
|
||||
|
||||
TEST_CASE(ConstructorAndDestructorNamesRemainHighlighted) {
|
||||
run_utf8(R"cpp(
|
||||
struct S {
|
||||
@ctor_decl[S]();
|
||||
@dtor_decl[~]S();
|
||||
};
|
||||
|
||||
S::@ctor_def[S]() {}
|
||||
|
||||
void use(S* value) {
|
||||
value->@dtor_ref[~]S();
|
||||
}
|
||||
)cpp");
|
||||
|
||||
auto declaration = modifier_mask({SymbolModifiers::Declaration});
|
||||
auto definition = modifier_mask({SymbolModifiers::Definition});
|
||||
auto special_member = modifier_mask({SymbolModifiers::ConstructorOrDestructor});
|
||||
|
||||
EXPECT_TOKEN("ctor_decl", SymbolKind::Method, declaration | special_member);
|
||||
EXPECT_TOKEN("dtor_decl", SymbolKind::Method, declaration | special_member);
|
||||
EXPECT_TOKEN("ctor_def", SymbolKind::Method, definition | special_member);
|
||||
EXPECT_TOKEN("dtor_ref", SymbolKind::Method, special_member);
|
||||
}
|
||||
|
||||
TEST_CASE(LegacyVarDeclTemplates) {
|
||||
run_utf8(R"cpp(
|
||||
extern int @x1[x];
|
||||
|
||||
Reference in New Issue
Block a user