mirror of
https://github.com/clangd/clangd.git
synced 2025-07-20 06:30:17 +00:00
Compare commits
63 Commits
snapshot_2
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
30a8f963f7 | ||
|
8f26871294 | ||
|
1e95a5944b | ||
|
439b0626d1 | ||
|
cb1cfd5a92 | ||
|
8ea4a27f46 | ||
|
0a7499759d | ||
|
909659b1ba | ||
|
cb870db274 | ||
|
ff6fd49148 | ||
|
d5998e7fce | ||
|
6e7f5968ba | ||
|
a729875fb1 | ||
|
1a90fba271 | ||
|
f707dfdeab | ||
|
ebce136114 | ||
|
64ccc9d3ec | ||
|
19a7bfdb2d | ||
|
9d058532be | ||
|
ca00967a89 | ||
|
1a5759b2da | ||
|
c0845399c6 | ||
|
c576bf40d1 | ||
|
e2345b0261 | ||
|
186c1cfe5b | ||
|
c4786ebf83 | ||
|
608aa9953c | ||
|
d78d99d3f3 | ||
|
ec24d11c53 | ||
|
d36dadfd99 | ||
|
fc7440e2e5 | ||
|
d561d317fc | ||
|
411063a83a | ||
|
239800b0c5 | ||
|
e279de4b94 | ||
|
fead93d1a9 | ||
|
fc26be2c43 | ||
|
3d90b39e96 | ||
|
40114796f0 | ||
|
bef10dc3c8 | ||
|
835256346b | ||
|
405dee024a | ||
|
ebde6ecac4 | ||
|
ae38d57cb9 | ||
|
94b525b2ee | ||
|
a276cdf62f | ||
|
02bad4f0eb | ||
|
8d1f3300c5 | ||
|
6f906275b0 | ||
|
6ab953a853 | ||
|
f34af43022 | ||
|
f779426513 | ||
|
5a40c019f1 | ||
|
d1d8b39c4c | ||
|
45b6fbdfb0 | ||
|
40dcef1871 | ||
|
9a0cad43e8 | ||
|
55b106258d | ||
|
61703d6bba | ||
|
b51dc0092f | ||
|
2de2ec4404 | ||
|
12c31b0756 | ||
|
722567248f |
7
.github/ISSUE_TEMPLATE/bug_report.md
vendored
7
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -13,11 +13,18 @@ For hints on what information is helpful, see: https://clangd.llvm.org/troublesh
|
||||
If you can, provide a minimal chunk of code that shows the problem (either inline, or attach it if larger).
|
||||
|
||||
**Logs**
|
||||
|
||||
Please attach the clangd stderr log if you can. (Usually available from the editor)
|
||||
If possible, run with `--log=verbose` - note that the logs will include the contents of open files!
|
||||
If this is a crash, try to put `llvm-symbolizer` on your PATH per the troubleshooting instructions.
|
||||
(If you're using Windows, place the associated PDB file (debug symbols) in the same directory as
|
||||
clangd.exe and rerun again. For official releases, download symbols from the
|
||||
[release page](https://github.com/clangd/clangd/releases).)
|
||||
|
||||
**System information**
|
||||
|
||||
Output of `clangd --version`:
|
||||
|
||||
Editor/LSP plugin:
|
||||
|
||||
Operating system:
|
||||
|
4
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
4
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
contact_links:
|
||||
- name: Questions and discussions
|
||||
url: https://github.com/clangd/clangd/discussions
|
||||
about: Usage questions, ideas and proposals
|
13
.github/ISSUE_TEMPLATE/release_cherrypick.md
vendored
Normal file
13
.github/ISSUE_TEMPLATE/release_cherrypick.md
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
name: Cherry-pick for release
|
||||
about: Nominate a bug fix to be backported to the current release branch
|
||||
title: 'Cherrypick: '
|
||||
labels: cherrypick
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Commit:
|
||||
- llvm/llvm-project@
|
||||
|
||||
Why is this important or safe?
|
15
.github/actions/pick/action.yml
vendored
15
.github/actions/pick/action.yml
vendored
@ -1,15 +0,0 @@
|
||||
name: 'Pick commit'
|
||||
description: 'Pick last successful commit from a repo'
|
||||
inputs:
|
||||
repo:
|
||||
description: 'Github repository e.g. llvm/llvm-project'
|
||||
required: true
|
||||
token:
|
||||
description: 'Github auth token'
|
||||
required: true
|
||||
outputs:
|
||||
sha:
|
||||
description: 'The SHA1 of the picked commit'
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'index.js'
|
18
.github/actions/pick/index.js
vendored
18
.github/actions/pick/index.js
vendored
@ -1,18 +0,0 @@
|
||||
const core = require('@actions/core');
|
||||
const last = require('last-successful-gh-commit').default;
|
||||
try {
|
||||
var parts = core.getInput('repo').split('/', 2);
|
||||
last({
|
||||
owner: parts[0],
|
||||
name: parts[1],
|
||||
token: core.getInput('token'),
|
||||
})
|
||||
.then(commit => core.setOutput('sha', commit.node.oid))
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
core.setFailed(error.message);
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
core.setFailed(error.message);
|
||||
}
|
56
.github/actions/pick/package-lock.json
generated
vendored
56
.github/actions/pick/package-lock.json
generated
vendored
@ -1,56 +0,0 @@
|
||||
{
|
||||
"name": "pick",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@actions/core": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.2.tgz",
|
||||
"integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg=="
|
||||
},
|
||||
"axios": {
|
||||
"version": "0.16.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.16.2.tgz",
|
||||
"integrity": "sha1-uk+S8XFn37q0CYN4VFS5rBScPG0=",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.2.3",
|
||||
"is-buffer": "^1.1.5"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "3.2.6",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
|
||||
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.10.0.tgz",
|
||||
"integrity": "sha512-4eyLK6s6lH32nOvLLwlIOnr9zrL8Sm+OvW4pVTJNoXeGzYIkHVf+pADQi+OJ0E67hiuSLezPVPyBcIZO50TmmQ==",
|
||||
"requires": {
|
||||
"debug": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"is-buffer": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
|
||||
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
|
||||
},
|
||||
"last-successful-gh-commit": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/last-successful-gh-commit/-/last-successful-gh-commit-1.0.1.tgz",
|
||||
"integrity": "sha1-8Mn8HfEvb764g/5vrcy3W4p5EVo=",
|
||||
"requires": {
|
||||
"axios": "^0.16.2"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
}
|
||||
}
|
||||
}
|
14
.github/actions/pick/package.json
vendored
14
.github/actions/pick/package.json
vendored
@ -1,14 +0,0 @@
|
||||
{
|
||||
"name": "pick",
|
||||
"version": "1.0.0",
|
||||
"description": "Pick the last successful commit from a github repo",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
"keywords": [],
|
||||
"author": "sam.mccall@gmail.com",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.2",
|
||||
"last-successful-gh-commit": "^1.0.1"
|
||||
}
|
||||
}
|
347
.github/workflows/autobuild.yaml
vendored
347
.github/workflows/autobuild.yaml
vendored
@ -1,78 +1,205 @@
|
||||
# Workflow to build binaries for a release.
|
||||
# Triggered by release creation, which should include `llvm-project@<full-sha>`.
|
||||
# Workflow to build binaries and release them.
|
||||
# Triggered by the schedule or manual dispatch, which might include
|
||||
# `<owner/llvm-project>@<full-sha>`.
|
||||
#
|
||||
# Because the build takes more than an hour, our GITHUB_TOKEN credentials may
|
||||
# expire. A token `secrets.RELEASE_TOKEN` must exist with public_repo scope.
|
||||
name: Build release binaries
|
||||
env:
|
||||
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
|
||||
on:
|
||||
release:
|
||||
types: created
|
||||
# Run weekly on sunday at 21:37 UTC (arbitrary)
|
||||
schedule:
|
||||
- cron: '37 21 * * SUN'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
commit:
|
||||
description: 'Commit to build from'
|
||||
required: true
|
||||
repo:
|
||||
description: 'Repository to build from'
|
||||
required: true
|
||||
default: 'llvm/llvm-project'
|
||||
release_name:
|
||||
description: 'Release name'
|
||||
required: true
|
||||
tag:
|
||||
description: 'Tag name'
|
||||
required: true
|
||||
description:
|
||||
description: 'Release description'
|
||||
required: true
|
||||
jobs:
|
||||
prepare:
|
||||
schedule_environment:
|
||||
name: Create default build environment
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event_name == 'schedule' }}
|
||||
steps:
|
||||
- name: Find LLVM commit
|
||||
- name: Install deps
|
||||
run: |
|
||||
grep -m 1 -o "llvm-project@[[:xdigit:]]\{40,\}" << EOF | cut -f 2 -d@ > commit
|
||||
${{ github.event.release.body }}
|
||||
EOF
|
||||
- name: Mark as draft
|
||||
sudo apt-get install jq
|
||||
- name: Clone scripts
|
||||
uses: actions/checkout@v2
|
||||
# Choose the commit to build a release from.
|
||||
#
|
||||
# We want to avoid unbuildable revisions: choose the last green from CI.
|
||||
# FIXME: The criteria should be some consistent set of buildbots passing.
|
||||
# Use clangd/actions/pick after
|
||||
# https://github.com/ramasilveyra/last-successful-gh-commit/issues/2 has
|
||||
# been addressed.
|
||||
- name: Get commit hash for LLVM head
|
||||
run: >
|
||||
curl --fail --show-error -XPATCH
|
||||
"-HAuthorization: Bearer ${{ secrets.RELEASE_TOKEN }}"
|
||||
"https://api.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}"
|
||||
"-d" '{"draft": true}'
|
||||
- name: Persist release info
|
||||
uses: actions/upload-artifact@v1
|
||||
COMMIT=$(curl --fail --show-error
|
||||
"https://api.github.com/repos/llvm/llvm-project/commits/main" |
|
||||
jq ".sha" -r)
|
||||
|
||||
echo "LLVM_COMMIT=$COMMIT" >> $GITHUB_ENV
|
||||
- name: Compute release info
|
||||
run: |
|
||||
echo "RELEASE_COMMIT_SHORT=$(printf '%.12s' ${{ env.LLVM_COMMIT }})" >> $GITHUB_ENV
|
||||
echo "RELEASE_DATE=$(date -u +%Y%m%d)" >> $GITHUB_ENV
|
||||
echo "LLVM_REPO=llvm/llvm-project" >> commit.env
|
||||
echo "LLVM_COMMIT=${{ env.LLVM_COMMIT }}" >> commit.env
|
||||
- name: Use date as the tag name
|
||||
run: >
|
||||
echo "TAG_NAME=snapshot_${{ env.RELEASE_DATE }}" >> commit.env
|
||||
- name: Use date and release commit as release name
|
||||
run: >
|
||||
echo "RELEASE_NAME=${{ env.RELEASE_DATE }} @${{ env.RELEASE_COMMIT_SHORT }}" >> commit.env
|
||||
- name: Generate default release description
|
||||
run: >
|
||||
echo "RELEASE_DESCRIPTION=Unstable snapshot of clangd on ${{ env.RELEASE_DATE }}." >> commit.env
|
||||
- name: Upload result
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: env
|
||||
path: commit.env
|
||||
workflow_dispatch_environment:
|
||||
name: Use inputs to create build environment
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||
steps:
|
||||
- name: Use repo and commit from the inputs
|
||||
run: |
|
||||
echo "LLVM_REPO=${{ github.event.inputs.repo }}" >> commit.env
|
||||
echo "LLVM_COMMIT=${{ github.event.inputs.commit }}" >> commit.env
|
||||
echo "TAG_NAME=${{ github.event.inputs.tag }}" >> commit.env
|
||||
echo "RELEASE_NAME=${{ github.event.inputs.release_name }}" >> commit.env
|
||||
echo "RELEASE_DESCRIPTION=${{ github.event.inputs.description }}" >> commit.env
|
||||
- name: Upload result
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: env
|
||||
path: commit.env
|
||||
create_release:
|
||||
name: Create release
|
||||
runs-on: ubuntu-latest
|
||||
needs: [schedule_environment, workflow_dispatch_environment]
|
||||
# Use always() and manually check results here since GitHub Actions do not
|
||||
# support conditionally skipping jobs and there is no way to "exit with
|
||||
# success" from a job.
|
||||
if: always() && (needs.schedule_environment.result == 'success' || needs.workflow_dispatch_environment.result == 'success')
|
||||
steps:
|
||||
- name: Fetch environment variables
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name:
|
||||
env
|
||||
path:
|
||||
env
|
||||
- name: Set environment variables
|
||||
run: |
|
||||
cat env/commit.env >> $GITHUB_ENV
|
||||
- name: Create release
|
||||
uses: actions/create-release@master
|
||||
id: create_release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ env.TAG_NAME }}
|
||||
release_name: ${{ env.RELEASE_NAME }}
|
||||
body: |
|
||||
${{ env.RELEASE_DESCRIPTION }}
|
||||
|
||||
Built from ${{ env.LLVM_REPO }}@${{ env.LLVM_COMMIT }}.
|
||||
prerelease: true
|
||||
draft: true
|
||||
- name: Preserve release info
|
||||
run: |
|
||||
echo "UPLOAD_URL=${{ steps.create_release.outputs.upload_url }}" >> release.env
|
||||
echo "TAG_NAME=${{ env.TAG_NAME }}" >> release.env
|
||||
echo "RELEASE_ID=${{ steps.create_release.outputs.id }}" >> release.env
|
||||
- name: Upload result
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release
|
||||
path: commit
|
||||
path: release.env
|
||||
# Build clangd using CMake/Ninja.
|
||||
#
|
||||
# This step is a template that runs on each OS, build config varies slightly.
|
||||
# Uploading releases needs a per-job token that expires after an hour.
|
||||
build:
|
||||
name: Build ${{ matrix.config.name }}
|
||||
needs: prepare
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
needs: create_release
|
||||
if: always() && needs.create_release.result == 'success'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- name: windows
|
||||
os: windows-latest
|
||||
preinstall: choco install ninja
|
||||
vcvars: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
|
||||
# FIXME: remove ALLOW_OLD_TOOLCHAIN once VS 16.5 is available.
|
||||
cmake: >
|
||||
os: windows-2022
|
||||
preinstall: choco install ninja nasm
|
||||
vcvars: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
|
||||
cflags: /O2 /DNDEBUG
|
||||
cmake: >-
|
||||
"-DCMAKE_C_COMPILER=cl"
|
||||
"-DCMAKE_CXX_COMPILER=cl"
|
||||
"-DCMAKE_CXX_FLAGS_RELEASE=/O2 /DNDEBUG"
|
||||
"-DCMAKE_C_FLAGS_RELEASE=/O2 /DNDEBUG"
|
||||
"-DLLVM_ENABLE_ZLIB=OFF"
|
||||
"-DLLVM_USE_CRT_RELEASE=MT"
|
||||
"-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON"
|
||||
"-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded"
|
||||
"-DLLVM_ENABLE_PDB=ON"
|
||||
"-DLLVM_PARALLEL_LINK_JOBS=1"
|
||||
grpc_cmake: >-
|
||||
"-DgRPC_MSVC_STATIC_RUNTIME=ON"
|
||||
binary_extension: ".exe"
|
||||
- name: mac
|
||||
os: macos-latest
|
||||
os: macos-13
|
||||
preinstall: brew install ninja zlib p7zip
|
||||
cmake: >
|
||||
cflags: -O3 -gline-tables-only -DNDEBUG
|
||||
cmake: >-
|
||||
"-DCMAKE_C_COMPILER=clang"
|
||||
"-DCMAKE_CXX_COMPILER=clang++"
|
||||
"-DCMAKE_C_FLAGS_RELEASE=-O3 -gline-tables-only -DNDEBUG"
|
||||
"-DCMAKE_CXX_FLAGS_RELEASE=-O3 -gline-tables-only -DNDEBUG"
|
||||
"-DLLVM_ENABLE_ZLIB=FORCE_ON"
|
||||
"-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64"
|
||||
"-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13"
|
||||
# BoringSSL doesn't support universal binaries when building with ASM.
|
||||
grpc_cmake: >-
|
||||
"-DOPENSSL_NO_ASM=ON"
|
||||
- name: linux
|
||||
os: ubuntu-latest
|
||||
preinstall: sudo apt-get install ninja-build libz-dev
|
||||
cmake: >
|
||||
"-DCMAKE_C_COMPILER=clang"
|
||||
"-DCMAKE_CXX_COMPILER=clang++"
|
||||
"-DCMAKE_CXX_FLAGS_RELEASE=-O3 -gline-tables-only -DNDEBUG"
|
||||
"-DCMAKE_C_FLAGS_RELEASE=-O3 -gline-tables-only -DNDEBUG"
|
||||
container: ubuntu:20.04
|
||||
preinstall: >-
|
||||
apt-get update &&
|
||||
apt-get install -y ninja-build libz-dev libc-ares-dev wget clang-10
|
||||
software-properties-common p7zip-full curl &&
|
||||
add-apt-repository ppa:git-core/ppa &&
|
||||
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add - &&
|
||||
apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' &&
|
||||
apt-get update &&
|
||||
apt-get install -y git cmake python3.8 python3.8-dev
|
||||
cflags: -O3 -gline-tables-only -DNDEBUG -include $GITHUB_WORKSPACE/.github/workflows/lib_compat.h
|
||||
cmake: >-
|
||||
"-DCMAKE_C_COMPILER=clang-10"
|
||||
"-DCMAKE_CXX_COMPILER=clang++-10"
|
||||
"-DCMAKE_EXE_LINKER_FLAGS_RELEASE=-static-libgcc -Wl,--compress-debug-sections=zlib"
|
||||
"-DLLVM_STATIC_LINK_CXX_STDLIB=ON"
|
||||
"-DLLVM_ENABLE_ZLIB=FORCE_ON"
|
||||
"-DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.a"
|
||||
"-DCMAKE_PROJECT_INCLUDE=$GITHUB_WORKSPACE/.github/workflows/linux-static-deps.cmake"
|
||||
# Using c-ares as a module prevents dynamic linking of unneeded
|
||||
# libraries. All other gRPC dependencies can be built from sources.
|
||||
grpc_cmake: >-
|
||||
"-DgRPC_CARES_PROVIDER=package"
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
container: ${{ matrix.config.container }}
|
||||
steps:
|
||||
- name: Clone scripts
|
||||
uses: actions/checkout@v2
|
||||
@ -88,20 +215,65 @@ jobs:
|
||||
run: |
|
||||
cmd /c "`"${{ matrix.config.vcvars }}`">NUL && set" | Foreach-Object {
|
||||
$name, $value = $_ -split '=', 2
|
||||
if ($value) { echo "::set-env name=$($name)::$($value)" }
|
||||
if ($value) {
|
||||
echo "$($name)=$($value)" >> $env:GITHUB_ENV
|
||||
}
|
||||
}
|
||||
- name: Clone gRPC
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: grpc/grpc
|
||||
path: grpc
|
||||
# We use the same version of gRPC for LLVM's clangd-ubuntu-tsan
|
||||
# buildbot.
|
||||
# https://github.com/llvm/llvm-zorg/blob/main/buildbot/google/docker/buildbot-clangd-ubuntu-clang/Dockerfile
|
||||
ref: v1.36.3
|
||||
submodules: recursive
|
||||
- name: Build gRPC
|
||||
run: >
|
||||
mkdir $HOME/grpc-installation
|
||||
|
||||
mkdir grpc-build
|
||||
|
||||
cmake -G Ninja -S grpc -B grpc-build
|
||||
"-DgRPC_INSTALL=ON"
|
||||
"-DCMAKE_INSTALL_PREFIX=$HOME/grpc-installation"
|
||||
"-DCMAKE_BUILD_TYPE=Release"
|
||||
"-DCMAKE_C_FLAGS_RELEASE=${{ matrix.config.cflags }}"
|
||||
"-DCMAKE_CXX_FLAGS_RELEASE=${{ matrix.config.cflags }}"
|
||||
${{ matrix.config.grpc_cmake }} ${{ matrix.config.cmake }}
|
||||
|
||||
ninja -C grpc-build install
|
||||
- name: Fetch target commit
|
||||
uses: actions/download-artifact@v1
|
||||
with: { name: release }
|
||||
- name: Set target commit
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name:
|
||||
env
|
||||
path:
|
||||
env
|
||||
- name: Fetch release info
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name:
|
||||
release
|
||||
path:
|
||||
release
|
||||
- name: Put release info into env
|
||||
run: |
|
||||
echo ::set-env name=LLVM_COMMIT::$(cat release/commit)
|
||||
echo ::set-env name=CLANGD_DIR::clangd_${{ github.event.release.tag_name }}
|
||||
cat env/commit.env >> $GITHUB_ENV
|
||||
cat release/release.env >> $GITHUB_ENV
|
||||
shell: bash
|
||||
# Use environment variables set above to create a directory. This needs
|
||||
# to be a separate step because they are not in the context yet when
|
||||
# being set.
|
||||
- name: Set build directory
|
||||
run: |
|
||||
echo "CLANGD_DIR=clangd_${{ env.TAG_NAME }}" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
- name: Clone LLVM
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: llvm/llvm-project
|
||||
repository: ${{ env.LLVM_REPO }}
|
||||
path: llvm-project
|
||||
ref: ${{ env.LLVM_COMMIT }}
|
||||
- name: CMake
|
||||
@ -111,43 +283,98 @@ jobs:
|
||||
cp llvm-project/llvm/LICENSE.TXT ${{ env.CLANGD_DIR }}
|
||||
|
||||
cmake -G Ninja -S llvm-project/llvm -B ${{ env.CLANGD_DIR }}
|
||||
"-DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra"
|
||||
"-DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra;openmp"
|
||||
"-DLLVM_ENABLE_ASSERTIONS=OFF"
|
||||
"-DLLVM_ENABLE_BACKTRACES=ON"
|
||||
"-DLLVM_ENABLE_TERMINFO=OFF"
|
||||
"-DCMAKE_BUILD_TYPE=Release"
|
||||
"-DCLANG_PLUGIN_SUPPORT=OFF"
|
||||
"-DLLVM_ENABLE_PLUGINS=OFF"
|
||||
"-DCMAKE_C_FLAGS_RELEASE=${{ matrix.config.cflags }}"
|
||||
"-DCMAKE_CXX_FLAGS_RELEASE=${{ matrix.config.cflags }}"
|
||||
"-DCLANGD_ENABLE_REMOTE=ON"
|
||||
"-DLLVM_ENABLE_ZSTD=OFF"
|
||||
"-DGRPC_INSTALL_PATH=$HOME/grpc-installation"
|
||||
${{ matrix.config.cmake }}
|
||||
- name: Ninja
|
||||
run: ninja -C ${{ env.CLANGD_DIR }} clangd
|
||||
- name: Archive
|
||||
run: >
|
||||
ninja -C ${{ env.CLANGD_DIR }} clangd clangd-indexer clangd-index-server
|
||||
clangd-index-server-monitor
|
||||
- name: Install OpenMP headers
|
||||
shell: bash
|
||||
run: >
|
||||
cp ${{ env.CLANGD_DIR }}/projects/openmp/runtime/src/omp{,-tools}.h ${{ env.CLANGD_DIR }}/lib/clang/*/include
|
||||
|| true # Don't let the non-existing omp headers block the release.
|
||||
- name: Archive clangd
|
||||
run: >
|
||||
7z a clangd.zip
|
||||
${{ env.CLANGD_DIR }}/LICENSE.TXT
|
||||
${{ env.CLANGD_DIR }}/bin/clangd*
|
||||
${{ env.CLANGD_DIR }}/bin/clangd${{ matrix.config.binary_extension }}
|
||||
${{ env.CLANGD_DIR }}/lib/clang
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: ${{ matrix.config.name }}
|
||||
path: clangd.zip
|
||||
- name: Upload asset
|
||||
- name: Archive clangd PDB symbols
|
||||
if: matrix.config.name == 'windows'
|
||||
run: >
|
||||
7z a clangd-pdb.7z -t7z -m0=LZMA2
|
||||
${{ env.CLANGD_DIR }}/LICENSE.TXT
|
||||
${{ env.CLANGD_DIR }}/bin/clangd.pdb
|
||||
- name: Archive indexing-tools
|
||||
run: >
|
||||
7z a indexing-tools.zip
|
||||
${{ env.CLANGD_DIR }}/LICENSE.TXT
|
||||
${{ env.CLANGD_DIR }}/bin/clangd-indexer${{ matrix.config.binary_extension }}
|
||||
${{ env.CLANGD_DIR }}/bin/clangd-index-server${{ matrix.config.binary_extension }}
|
||||
${{ env.CLANGD_DIR }}/bin/clangd-index-server-monitor${{ matrix.config.binary_extension }}
|
||||
${{ env.CLANGD_DIR }}/lib/clang
|
||||
- name: Upload clangd asset
|
||||
uses: actions/upload-release-asset@v1.0.1
|
||||
env: { GITHUB_TOKEN: "${{ secrets.RELEASE_TOKEN }}" }
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_name: clangd-${{ matrix.config.name }}-${{ github.event.release.tag_name }}.zip
|
||||
upload_url: ${{ env.UPLOAD_URL }}
|
||||
asset_name: clangd-${{ matrix.config.name }}-${{ env.TAG_NAME }}.zip
|
||||
asset_path: clangd.zip
|
||||
asset_content_type: application/zip
|
||||
- name: Upload clangd PDB asset
|
||||
if: matrix.config.name == 'windows'
|
||||
uses: actions/upload-release-asset@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ env.UPLOAD_URL }}
|
||||
asset_name: clangd-debug-symbols-${{ matrix.config.name }}-${{ env.TAG_NAME }}.7z
|
||||
asset_path: clangd-pdb.7z
|
||||
asset_content_type: application/zip
|
||||
- name: Upload indexing-tools asset
|
||||
uses: actions/upload-release-asset@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ env.UPLOAD_URL }}
|
||||
asset_name: clangd_indexing_tools-${{ matrix.config.name }}-${{ env.TAG_NAME }}.zip
|
||||
asset_path: indexing-tools.zip
|
||||
asset_content_type: application/zip
|
||||
- name: Check binary compatibility
|
||||
if: matrix.config.name == 'linux'
|
||||
run: .github/workflows/lib_compat_test.py --lib=GLIBC_2.18 "$CLANGD_DIR/bin/clangd"
|
||||
# Create the release, and upload the artifacts to it.
|
||||
finalize:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: always() && needs.build.result == 'success'
|
||||
steps:
|
||||
- name: Fetch release info
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name:
|
||||
release
|
||||
path:
|
||||
release
|
||||
- name: Update the env variables
|
||||
run: >
|
||||
cat release/release.env >> $GITHUB_ENV
|
||||
- name: Publish release
|
||||
run: >
|
||||
curl -XPATCH
|
||||
"-HAuthorization: Bearer ${{ secrets.RELEASE_TOKEN }}"
|
||||
"https://api.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}"
|
||||
"https://api.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}"
|
||||
"-d" '{"draft": false}'
|
||||
|
21
.github/workflows/lib_compat.h
vendored
Normal file
21
.github/workflows/lib_compat.h
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// This header forces the use of a particular version of glibc symbols.
|
||||
// This can make the resulting binary portable to systems with older glibcs.
|
||||
//
|
||||
// It must be included in each TU, with CFLAGS="-include glibc_compat.h" etc.
|
||||
//
|
||||
// We only list symbols known to be used. This is paired with a test enforcing
|
||||
// the max glibc symbol version. If the test fails, the list should be extended.
|
||||
// Find the old alternatives version to target with e.g.:
|
||||
// objdump -T /lib/x86_64-linux-gnu/lib{c,m,pthread,rt}.so.* | grep "\bexpf\b"
|
||||
|
||||
#define FORCE_SYMBOL_VERSION(sym, version) \
|
||||
__asm__(".symver " #sym "," #sym "@" #version)
|
||||
|
||||
FORCE_SYMBOL_VERSION(exp2, GLIBC_2.2.5);
|
||||
FORCE_SYMBOL_VERSION(expf, GLIBC_2.2.5);
|
||||
FORCE_SYMBOL_VERSION(log, GLIBC_2.2.5);
|
||||
FORCE_SYMBOL_VERSION(log2, GLIBC_2.2.5);
|
||||
FORCE_SYMBOL_VERSION(pow, GLIBC_2.2.5);
|
||||
FORCE_SYMBOL_VERSION(exp, GLIBC_2.2.5);
|
||||
|
||||
#undef FORCE_SYMBOL_VERSION
|
89
.github/workflows/lib_compat_test.py
vendored
Executable file
89
.github/workflows/lib_compat_test.py
vendored
Executable file
@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Verifies a binary uses only dynamic symbols from whitelisted library versions.
|
||||
# Prints the disallowed symbols and their versions on failure.
|
||||
# Usage: lib_compat_test.py bin/clangd --lib=GLIBC_2.18
|
||||
|
||||
import argparse
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("binary")
|
||||
parser.add_argument(
|
||||
"--lib",
|
||||
action="append",
|
||||
default=[],
|
||||
help="Whitelist a library, e.g. GLIBC_2.18 or GLIBC",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--sym", action="append", default=[], help="Whitelist a symbol, e.g. crc32"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# Parses GLIBC_2.3 into ("GLIBC", [2,3])
|
||||
# Parses GLIBC into ("GLIBC", None)
|
||||
def parse_version(version):
|
||||
parts = version.rsplit("_", 1)
|
||||
if len(parts) == 1:
|
||||
return (version, None)
|
||||
try:
|
||||
return (parts[0], [int(p) for p in parts[1].split(".")])
|
||||
except ValueError:
|
||||
return (version, None)
|
||||
|
||||
|
||||
lib_versions = dict([parse_version(v) for v in args.lib])
|
||||
|
||||
# Determines whether all symbols with version 'lib' are acceptable.
|
||||
# A versioned library is name_x.y.z by convention.
|
||||
def accept_lib(lib):
|
||||
(lib, ver) = parse_version(lib)
|
||||
if not lib in lib_versions: # Non-whitelisted library.
|
||||
return False
|
||||
if lib_versions[lib] is None: # Unrestricted version
|
||||
return True
|
||||
if ver is None: # Lib has non-numeric version, library restricts version.
|
||||
return False
|
||||
return ver <= lib_versions[lib]
|
||||
|
||||
|
||||
# Determines whether an optionally-versioned symbol is acceptable.
|
||||
# A versioned symbol is symbol@version as output by nm.
|
||||
def accept_symbol(sym):
|
||||
if sym in args.sym:
|
||||
return True
|
||||
split = sym.split("@", 1)
|
||||
return (split[0] in args.sym) or (len(split) == 2 and accept_lib(split[1]))
|
||||
|
||||
|
||||
# Run nm to find the undefined symbols, and check whether each is acceptable.
|
||||
nm = subprocess.run(
|
||||
["nm", "-uD", "--with-symbol-version", args.binary],
|
||||
stdout=subprocess.PIPE,
|
||||
universal_newlines=True,
|
||||
)
|
||||
nm.check_returncode()
|
||||
status = 0
|
||||
for line in nm.stdout.splitlines():
|
||||
# line = " U foo@GLIBC_2.3"
|
||||
parts = line.split()
|
||||
if len(parts) != 2:
|
||||
print("Unparseable nm output: ", line, file=sys.stderr)
|
||||
status = 2
|
||||
continue
|
||||
if parts[0] == "w": # Weak-undefined symbol, not actually required.
|
||||
continue
|
||||
if not accept_symbol(parts[1]):
|
||||
print(parts[1])
|
||||
status = 1
|
||||
if status == 1:
|
||||
print(
|
||||
"Binary depends on disallowed symbols above. Use some combination of:\n"
|
||||
" - relax the whitelist by adding --lib and --sym flags to this test\n"
|
||||
" - force older symbol versions by updating lib_compat.h\n"
|
||||
" - avoid dynamic dependencies by changing CMake configuration\n"
|
||||
" - remove bad dependencies from the code",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(status)
|
3
.github/workflows/linux-static-deps.cmake
vendored
Normal file
3
.github/workflows/linux-static-deps.cmake
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Convince find_package() to link against libz.a instead of libz.so.
|
||||
# The default is ".so;.a", meaning dynamic libraries are preferred.
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
55
.github/workflows/periodic.yaml
vendored
55
.github/workflows/periodic.yaml
vendored
@ -1,55 +0,0 @@
|
||||
# Workflow to create an auto-buildable release periodically.
|
||||
#
|
||||
# Releases created with automation credentials don't trigger workflows.
|
||||
# Therefore a token `secrets.RELEASE_TOKEN` must exist with public_repo scope.
|
||||
name: Periodic release
|
||||
on:
|
||||
# Run weekly on sunday at 21:37 UTC (arbitrary)
|
||||
schedule:
|
||||
- cron: '37 21 * * SUN'
|
||||
# Allow triggering manually:
|
||||
# curl -XPOST -d '{"event_type":"periodic"}' \
|
||||
# "-HAuthorization: Bearer <token>" \
|
||||
# https://api.github.com/repos/clangd/clangd/dispatches
|
||||
repository_dispatch: { types: periodic }
|
||||
jobs:
|
||||
# Choose the commit to build a release from.
|
||||
#
|
||||
# We want to avoid unbuildable revisions: choose the last green from CI.
|
||||
# FIXME: the criteria should be some consistent set of buildbots passing.
|
||||
pick:
|
||||
name: Create draft release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone scripts
|
||||
uses: actions/checkout@v2
|
||||
- name: Install NPM dependencies
|
||||
run: npm install --prefix .github/actions/pick
|
||||
- name: Pick last successful commit
|
||||
id: pick
|
||||
uses: ./.github/actions/pick
|
||||
with:
|
||||
repo: llvm/llvm-project
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Compute release info
|
||||
run: |
|
||||
echo ::set-env name=RELEASE_COMMIT_SHORT::$(printf "%.12s" ${{ steps.pick.outputs.sha }})
|
||||
echo ::set-env name=RELEASE_DATE::$(date -u +%Y%m%d)
|
||||
- name: Create release
|
||||
uses: actions/create-release@master
|
||||
id: release
|
||||
env: { GITHUB_TOKEN: "${{ secrets.RELEASE_TOKEN }}" }
|
||||
with:
|
||||
tag_name: snapshot_${{ env.RELEASE_DATE }}
|
||||
release_name: ${{ env.RELEASE_DATE }} @${{ env.RELEASE_COMMIT_SHORT }}
|
||||
body: |
|
||||
Unstable snapshot of clangd on ${{ env.RELEASE_DATE }}.
|
||||
|
||||
Built from llvm/llvm-project@${{ steps.pick.outputs.sha }}.
|
||||
prerelease: true
|
||||
# It would be nice to use draft releases, to hide them from users.
|
||||
# But drafts don't fire events to trigger the autobuild workflow.
|
||||
# Instead, that workflow marks the release as draft until it's built.
|
||||
# As a result, the empty release will be briefly visible to users.
|
||||
draft: false
|
||||
|
@ -5,7 +5,7 @@ This is not its documentation.
|
||||
|
||||
- the **website** is https://clangd.llvm.org/.
|
||||
- the **bug tracker** is in this repository: https://github.com/clangd/clangd/issues
|
||||
- the **source code** is hosted at https://github.com/llvm/llvm-project/tree/master/clang-tools-extra/clangd.
|
||||
- the **source code** is hosted at https://github.com/llvm/llvm-project/tree/main/clang-tools-extra/clangd.
|
||||
- the **website source code** is at https://github.com/llvm/clangd-www/
|
||||
|
||||
### Communication channels
|
||||
|
@ -8,7 +8,8 @@ is being able to cut releases easily whenever we want.
|
||||
The releases are just a zip archive containing the `clangd` binary, and the
|
||||
clang builtin headers. They should be runnable immediately after extracting the
|
||||
archive. The linux binary has `libstdc++` and other dependencies statically
|
||||
linked for maximum portability.
|
||||
linked for maximum portability, and requires glibc 2.18 (the first version with
|
||||
`thread_local` support).
|
||||
|
||||
## Creating a release manually
|
||||
|
||||
|
27
scripts/compile_flags_json.py
Executable file
27
scripts/compile_flags_json.py
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python
|
||||
import os, sys, json
|
||||
|
||||
EXTS = ('.c','.C','.cpp','.cc','.cxx','.m','.mm'
|
||||
'.h','.H','.hpp','.hh','.hxx')
|
||||
|
||||
input = sys.argv[1] if len(sys.argv) > 1 else 'compile_flags.txt'
|
||||
driver = sys.argv[2] if len(sys.argv) > 2 else 'clang'
|
||||
with open(input) as f:
|
||||
flags = [line.strip() for line in f]
|
||||
|
||||
dir = os.path.dirname(os.path.abspath(input))
|
||||
|
||||
entries = []
|
||||
|
||||
for root, dirs, files in os.walk(dir):
|
||||
for file in files:
|
||||
ext = os.path.splitext(file)[1]
|
||||
if ext in EXTS:
|
||||
entries.append({
|
||||
'directory': dir,
|
||||
'file': os.path.join(dir, file),
|
||||
'arguments': [driver] + flags + [os.path.join(dir, file)]})
|
||||
|
||||
with open(os.path.join(dir, 'compile_commands.json'), 'w') as file:
|
||||
json.dump(entries, file, indent=2)
|
||||
|
Loading…
Reference in New Issue
Block a user