Compare commits

...

67 Commits

Author SHA1 Message Date
InfinityWei
439b0626d1
Fix MacOS CI builds (#2354) 2025-04-02 02:18:35 -04:00
Kevin
cb1cfd5a92
Fix Linux CI builds (#2319)
- Use container: ubuntu:20.04 instead of container: ubuntu:18.04.
- Add `exp` to `lib_compat.h` to solve the GLIBC 2.29 dependency issue.

Fixes https://github.com/clangd/clangd/issues/2244
2025-02-09 02:05:11 -05:00
Nathan Ridge
8ea4a27f46
Use upload-artifact@v4 and download-artifact@v4 (#2306)
Fixes https://github.com/clangd/clangd/issues/2305
2025-01-31 02:24:44 -05:00
Nathan Ridge
0a7499759d
Use macos-13 image for Mac builds (#2304) 2025-01-30 10:05:47 -05:00
Younan Zhang
909659b1ba
Build PDB file for Windows (#1678)
This allows dumping human-readable backtrace symbols with line numbers.

Also limit the maximum link jobs to 1 to avoid OOM in CI.
2024-12-01 20:24:14 -05:00
InfinityWei
cb870db274
Bump upload-artifact and download-artifact version to v3 (#2141)
v1 and v2 have been deprecated and workflows that try to use them now fail
2024-09-13 00:53:36 -04:00
InfinityWei
ff6fd49148
Fix weekly snapshot releases (#2084)
The release was broken because the macos-latest image was upgraded from macos-12 to macos-14, resulting in AppleClang being updated from version 14 to 15. To resolve the problem, modify macos-latest back to macos-12.

Additionally, the Linux build now needs Python 3.8, and the ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION environment variable enabled to keep using node 16.

Fixes #2028
2024-07-08 03:42:32 -04:00
ceron257
d5998e7fce Fixes #1793 - Fix runtime linkage 2023-11-17 13:29:30 +01:00
Kadir Cetinkaya
6e7f5968ba Use ubuntu-18.04 container to build linux binaries
Github action runners no longer support ubuntu-18.04 hosts and starting
with ubuntu-20.04 our binaries depend on glibc2.30, which is quite
recent. We're switching to building on ubuntu-18.04 containers instead
to not increase requirements.
2023-04-14 18:34:25 +02:00
Sam McCall
a729875fb1
Disable zstd (we don't use it)
This was leading to "library not loaded" errors on macs with no zstd
2022-09-15 20:06:18 +02:00
Kadir Cetinkaya
1a90fba271 Use windows-2019 explicitly in CI 2022-02-21 16:03:58 +01:00
Kadir Cetinkaya
f707dfdeab Use bash shell in Install OpenMP task and don't let copy fail 2022-01-21 09:45:27 +01:00
Kadir Cetinkaya
ebce136114 Fix windows snapshot builds 2022-01-17 14:05:27 +01:00
Kirill Bobyrev
64ccc9d3ec
Rename config.yaml to config.yml
.yaml extension does not seem to work. Context:
ca00967a89
2022-01-03 19:22:56 +01:00
Sam McCall
19a7bfdb2d Oops, fix path to OpenMP headers. 2022-01-03 18:30:19 +01:00
Sam McCall
9d058532be Include omp{,-tools}.h in the releases
This is really ugly, but AFAICT:
 - omp.h is not a "builtin clang header" in the usual sense, but when
   openmp is built it installs to clang's resource dir to be "always
   available"
 - this makes it into clang packages, e.g. debian's libclang-common-11-dev.
 - as a result, if we don't ship it, then <omp.h> can be found by system
   clang but not by us.
2022-01-03 18:30:19 +01:00
Kirill Bobyrev
ca00967a89
Link to GitHub Discussions when opening an issue (#975)
That will increase the visibility of the Discussions mechanism.
2022-01-03 17:59:22 +01:00
Kadir Cetinkaya
1a5759b2da Explicitly set OSX_DEPLOYMENT_TARGET in cmake flags, as
matrix.config.env is not propagated into job's env variables.
2021-11-04 11:37:08 +01:00
Kirill Bobyrev
c0845399c6
Merge periodic workflow into autobuild (#786)
The only reason to have a separate periodic action was the ability to
run the action "manually" by creating an appropriate release. With the
workflow_dispatch, we can actually trigger the workflow manually with
a convenient UI. Hence, periodic is no longer needed.
2021-08-04 16:04:55 +03:00
Kirill Bobyrev
c576bf40d1
NFC: Improve Bug Report issue template
Since this is a Markdown file, line breaks are needed for proper formatting. Otherwise, Preview joins lines that were not supposed to be together.
2021-07-29 14:26:58 +03:00
Kadir Cetinkaya
e2345b0261 Build fat binaries for mac 2021-07-09 10:12:57 +02:00
Kirill Bobyrev
186c1cfe5b
Bump gRPC version: 1.33.2 -> 1.36.3 (#783)
Builds started to fail
(https://github.com/clangd/clangd/runs/2595990099?check_suite_focus=true)
because Abseil source file (built as a part of gRPC) was using
`std::numeric_limits` and `uint32_t` but not including `<limits>` and
`<cstdint>` directly
(df3ea785d8/absl/synchronization/internal/graphcycles.cc).

This worked with libstdc++ 10 but GitHub Actions recently updated the
toolchain for Ubuntu 18.04 LTS we're using
(0409144182 (diff-8d528b68ca937dfe5a0194829f0eb2633bc3d7a3105a637ccb534a4da765f7a3R17)).
libstdc++ 11 changed the standard headers and is now less forgiving when
it comes to `<limits>` and few other headers not being included directly
(https://gcc.gnu.org/gcc-11/porting_to.html#:~:text=%3Climits%3E%20%28for%20std%3A%3Anumeric_limits%29).

This patch increases the gRPC version we use to fix the CI. Another
viable solution is "downgrading" back to libstdc++10 (e.g. via `sudo
apt-get remove -y libgcc-11-dev`).

This also requires changes in
https://github.com/llvm/llvm-zorg/blob/master/buildbot/google/docker/buildbot-clangd-ubuntu-clang/Dockerfile
for consistency.
2021-06-07 15:30:56 +03:00
Kirill Bobyrev
c4786ebf83 Revert "Downgrade to libgcc10"
This reverts commit 608aa9953c in favor of
https://github.com/clangd/clangd/pull/783
2021-06-07 14:29:21 +02:00
Kadir Cetinkaya
608aa9953c Downgrade to libgcc10
gRPC version we use cannot be compiled with libstdc++ that comes with
gcc11 due to a change in transitive dependencies.

This is a temporary fix until we bump the grpc version in a bunch of
deployments.
2021-05-21 11:44:15 +02:00
Kadir Cetinkaya
d78d99d3f3 Package index-server-monitor in indexing-tools 2021-05-04 13:06:09 +02:00
Sam McCall
ec24d11c53 Rename clangd-indexing-tools-platform-version.zip -> clangd_indexing_tools-platform-version.zip
This allows autoupdate to work in our buggy clients.
See https://github.com/clangd/vscode-clangd/issues/180

Stylistic justification: "clangd_indexing_tools" is one "word" in the
"name-platform-version.zip" naming convention.
2021-04-22 12:17:05 +02:00
Kirill Bobyrev
d36dadfd99
Fix the typo (gthub -> github) 2021-04-21 18:42:27 +02:00
Kirill Bobyrev
fc7440e2e5
Allow using a different repository for the manual release (#754)
Extract the repository from the release message. This will help us have
more control over the release process.
2021-04-21 19:37:50 +03:00
Sam McCall
d561d317fc Script to generate compile_commands.json from compile_flags.txt
This enables background index for a compile_flags.txt driven project.
(We should really have a better solution for this)
2021-03-05 23:10:38 +01:00
Kadir Cetinkaya
411063a83a Use ubuntu-18 for older glibc
There's pthread_cond_clockwait@GLIBC_2.30 introduced with new glibc,
which isn't available in older versions. To prevent such breakages we
are sticking to ubuntu-18 rather than moving to ubuntu-20.

For a sample error see
https://github.com/kadircet/clangd/runs/2011039246?check_suite_focus=true.

Version label grabbed from
https://github.com/actions/virtual-environments.
2021-03-02 15:02:21 +01:00
Kadir Cetinkaya
239800b0c5
Trim trailing newlines for non-linux too 2021-03-02 08:34:05 +01:00
Kadir Cetinkaya
e279de4b94
Trim trailing newlines from cmake args 2021-03-02 08:24:46 +01:00
Kirill Bobyrev
fead93d1a9
Fix YAML syntax
Additional newline is created for CMake arguments.
2021-03-02 07:05:24 +01:00
Kirill Bobyrev
fc26be2c43
Fix the build after 40114796f0
That patch added new flags but gRPC is still built with GNU C++
compiler. If we're trying to build both gRPC and LLVM with the same set
of flags, we should enforce additional CMake flags for gRPC.
2021-03-02 06:58:25 +01:00
Kadir Cetinkaya
3d90b39e96
Get rid of stale fixme 2021-02-26 14:55:06 +01:00
Kadir Cetinkaya
40114796f0 Include lib_compat.h while building gRPC
While building clangd binaries we set required glibc version for symbols
to a minimum to cover systems with older glibc implementations. But we
were not doing that while building gRPC, which might depend on never
versions of these symbols.
2021-02-26 12:50:28 +01:00
Kirill Bobyrev
bef10dc3c8
Do not upload in autobuild job (#563)
Artifacts are used to pass data from one job to another but we upload
release assets in the same job we build them, hence artifacts are
redundant.
2021-02-17 12:53:11 +03:00
Kadir Cetinkaya
835256346b Use LLVM head for builds
clangd/actions/pick is currently broken because LLVM no longer has a
branch called master. We didn't have any releases for past 3 weeks, i've
contacted author in
https://github.com/ramasilveyra/last-successful-gh-commit/issues/2.
2021-02-16 16:16:17 +01:00
HO-COOH
405dee024a
fix clangd source link (#688) 2021-02-09 18:12:52 +03:00
Kirill Bobyrev
ebde6ecac4
Expand path to grpc-installation directory
Weekly snapshot builds are failing because CMake couldn't find gRPC and
Protobuf libraries. Expanding the path from relative to the full one
solves the problem.

Fixes: https://github.com/clangd/clangd/issues/641
2021-01-13 12:11:12 +01:00
Sam McCall
ae38d57cb9 Remove obsolete compiler hack from windows build config.
MSVC version is now 16.7+, see
https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
2020-11-29 12:27:07 +01:00
Kirill Bobyrev
94b525b2ee
Bump gRPC version to 1.33.2 (#592)
* Bump gRPC version to 1.33.2

This is the same version we are using in our buildbot, so this will
surely be the "stable" version for us right now.
2020-11-17 18:02:12 +03:00
Kadir Cetinkaya
a276cdf62f Change escaping of double quotes to single quote
Release names contains quotes around commit hashes due to the escaping.
After this patch, they'll be gone.
2020-10-26 11:33:24 +01:00
Kirill Bobyrev
02bad4f0eb
Bundle headers in indexing-tools release archive (#570) 2020-10-23 17:00:11 +02:00
Kirill Bobyrev
8d1f3300c5
Enable gRPC support for macOS and Windows (#565) 2020-10-18 13:58:12 +02:00
Kirill Bobyrev
6f906275b0
Add clangd-index-server to release asset 2020-10-18 11:30:15 +02:00
Kirill Bobyrev
6ab953a853
Build clangd-indexer and upload an asset with it next to clangd.zip (#560) 2020-10-16 17:04:12 +02:00
Kirill Bobyrev
f34af43022
Enable gRPC support for clangd on Linux (#561)
This patch introduces remote index support for binaries built on Linux. Other platforms will be added soon.
2020-10-16 17:03:34 +02:00
Kirill Bobyrev
f779426513
Remove deprecated set-env command (#553)
Remove deprecated set-env command

Environment files are to be used instead now:

https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
2020-10-15 11:36:18 +02:00
Kirill Bobyrev
5a40c019f1
Pull "pick" action into clangd/actions (#552) 2020-10-06 10:40:21 +02:00
dependabot[bot]
d1d8b39c4c Bump @actions/core from 1.2.2 to 1.2.6 in /.github/actions/pick
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.2 to 1.2.6.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-02 12:43:09 +02:00
Sam McCall
45b6fbdfb0 Try to fix static libz on linux 2020-09-24 16:33:20 +02:00
Haojian Wu
40dcef1871 Set MACOSX_DEPLOYMENT_TARGET flag.
Make sure we support older version of macOS (10.9+) when building clangd with
the latest macOS (10.15).
2020-09-14 12:36:51 +02:00
Sam McCall
9a0cad43e8 Issue template for cherrypicks 2020-06-10 05:16:38 +02:00
Sam McCall
55b106258d
Compat with older python 2020-05-08 00:01:38 +02:00
Sam McCall
61703d6bba
Fix typo 2020-05-07 19:57:36 +02:00
Sam McCall
b51dc0092f
Test that linux binary depends on glibc 2.18 and no other dynamic symbols (#372)
This regressed twice over the last two months (new floating point
function versions, and accidental dynamic linking against zlib).
We also want to avoid regressions when merging remote index.

The test is able to do a little bit more than we use in the automated
build (the --sym flag is unused, as is unversioned --lib=GLIBC) but they're
pretty useful when experimenting with how to fix things!

We run the test right at the end, because if it fails we want to be able
to download the binary artifact and inspect it.
Unfortunately by the nature of the test we can only run it when we
produce a build, so currently weekly.
2020-05-07 15:50:12 +02:00
Sam McCall
2de2ec4404 Link against older, more-compatible versiosn of glibc symbols.
They're binary-compatible, the old versions are more widely available
and the new versions are more highly optimized. We prefer the former.
2020-05-07 15:19:22 +02:00
Sam McCall
12c31b0756 Extract cflags to variable to avoid duplication. NFC 2020-05-07 15:19:22 +02:00
Sam McCall
722567248f
Fix static linking of zlib. (#370)
Fix static linking of zlib.

Use of the standard FindZLIB and thus support for ZLIB_LIBRARIES was
removed upstream in llvm/llvm-project@916be8fd6a
2020-05-07 12:44:29 +02:00
Sam McCall
d740d020b6 [logo] media cards with subtitles for vscode-clangd etc repositories 2020-04-22 13:30:04 +02:00
Sam McCall
45de907b37 Also create SVG logo 2020-04-21 12:45:07 +02:00
Sam McCall
adc3c29c7f Add logo. Programmer art! 2020-04-21 12:36:33 +02:00
Sam McCall
efb0a8fab5 Add LLVM license in preparation for adding logo 2020-04-21 12:35:42 +02:00
Sam McCall
e7efb79737
Update issue template to point to new docs 2020-03-12 11:00:12 +01:00
Sam McCall
68c8b97885
Update README.md to point to new docs 2020-03-12 10:59:33 +01:00
Sam McCall
1e1281022b Update issue templates 2020-03-10 18:16:53 +01:00
24 changed files with 1058 additions and 223 deletions

30
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,30 @@
---
name: Bug report
about: A problem encountered using clangd
title: ''
labels: ''
assignees: ''
---
Please describe the problem.
For hints on what information is helpful, see: https://clangd.llvm.org/troubleshooting.html
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
View File

@ -0,0 +1,4 @@
contact_links:
- name: Questions and discussions
url: https://github.com/clangd/clangd/discussions
about: Usage questions, ideas and proposals

View File

@ -0,0 +1,10 @@
---
name: Feature request
about: Suggest an idea for clangd
title: ''
labels: enhancement
assignees: ''
---

View 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?

View File

@ -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'

View File

@ -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);
}

View File

@ -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=="
}
}
}

View File

@ -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"
}
}

View File

@ -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
os: windows-2019
preinstall: choco install ninja nasm
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: >
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-9
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-9"
"-DCMAKE_CXX_COMPILER=clang++-9"
"-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-${{ matrix.config.name }}-${{ env.TAG_NAME }}-debug-symbols.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
View 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
View 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)

View 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")

View File

@ -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

219
LICENSE Normal file
View File

@ -0,0 +1,219 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--- LLVM Exceptions to the Apache 2.0 License ----
As an exception, if, as a result of your compiling your source code, portions
of this Software are embedded into an Object form of such source code, you
may redistribute such embedded portions in such Object form without complying
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
In addition, if you combine or link compiled forms of this Software with
software that is licensed under the GPLv2 ("Combined Software") and if a
court of competent jurisdiction determines that the patent provision (Section
3), the indemnity provision (Section 9) or other Section of the License
conflicts with the conditions of the GPLv2, you may retroactively and
prospectively choose to deem waived or otherwise exclude such Section(s) of
the License, but only in their entirety and only with respect to the Combined
Software.

View File

@ -3,11 +3,10 @@
clangd is a language server, and provides C++ IDE features to editors.
This is not its documentation.
- the **website** is https://clangd.github.io/.
- 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 http://llvm.org/, and mirrored at
https://github.com/llvm/llvm-project/tree/master/clang-tools-extra/clangd.
- the **website source code** is at https://github.com/clangd/clangd.github.io/
- 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
@ -16,5 +15,5 @@ through one of these channels:
- chat: #clangd room hosted on [LLVM's Discord
channel](https://discord.gg/xS7Z362).
- user questions and feature requests can be asked in Clangd topic on [LLVM
- user questions and feature requests can be asked in the clangd topic on [LLVM
Discussion Forums](https://llvm.discourse.group/c/llvm-project/clangd/34)

1
logo/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
card-*.png

21
logo/build.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash -ex
SMALLER="-strip -define png:compression-filter=3"
PAD_TO="-background none -gravity center -extent"
LOGO_ONLY="--export-id=CD --export-background-opacity=0"
CONTRAST="-level 20%,100%,1.4"
inkscape clangd.svg $LOGO_ONLY --export-plain-svg=logo.svg
inkscape clangd.svg --export-png=card.png -h=640
mogrify $SMALLER card.png
inkscape clangd.svg --export-png=logo.png -h=1024 $LOGO_ONLY
mogrify $SMALLER $PAD_TO 1024x1024 logo.png
inkscape clangd.svg --export-png=favicon.png -h=16 $LOGO_ONLY --export-area-snap
mogrify -define png:exclude-chunk=all $CONTRAST $PAD_TO 16x16 favicon.png
# Set CARD="vscode coc www" to generate cards with subtitles.
for CARD in $CARDS; do
xmlstarlet < clangd.svg edit -P \
--update "//*[@id='subtitle']/*[local-name()='tspan']" --value "$CARD" \
| inkscape - --export-png=card-$CARD.png -h=640
mogrify $SMALLER card-$CARD.png
done

BIN
logo/card.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

190
logo/clangd.svg Normal file
View File

@ -0,0 +1,190 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="200mm"
height="100mm"
viewBox="0 0 200 100"
version="1.1"
id="svg8"
inkscape:export-filename="/home/sammccall/card.png"
inkscape:export-xdpi="162.56"
inkscape:export-ydpi="162.56"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
sodipodi:docname="clangd.svg">
<defs
id="defs2">
<linearGradient
inkscape:collect="always"
id="linearGradient6203">
<stop
id="stop6201"
offset="0"
style="stop-color:#f0f8a0;stop-opacity:1" />
<stop
style="stop-color:#c1e0a4;stop-opacity:1;"
offset="0.75"
id="stop6272" />
<stop
id="stop6199"
offset="1"
style="stop-color:#5aab7b;stop-opacity:1" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient6195">
<stop
style="stop-color:#0f5499;stop-opacity:1"
offset="0"
id="stop6191" />
<stop
style="stop-color:#0ed6ff;stop-opacity:1"
offset="1"
id="stop6193" />
</linearGradient>
<linearGradient
id="linearGradient6119"
osb:paint="solid">
<stop
style="stop-color:#75af89;stop-opacity:1;"
offset="0"
id="stop6117" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6195"
id="linearGradient6197"
x1="87.3125"
y1="236.14583"
x2="109.80209"
y2="199.10417"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-42.33333,27.781253)" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient6203"
id="radialGradient6287"
cx="93.45755"
cy="230.91721"
fx="93.45755"
fy="230.91721"
r="20.843767"
gradientTransform="matrix(-2.0309823,-8.6890853e-7,7.0332774e-7,-1.6935434,253.83964,637.53298)"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient6203"
id="radialGradient6314"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-2.0309823,-8.6890853e-7,7.0332774e-7,-1.6935434,253.83964,637.53298)"
cx="93.45755"
cy="230.91721"
fx="93.45755"
fy="230.91721"
r="20.843767" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6195"
id="linearGradient6316"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-42.33333,27.781253)"
x1="87.3125"
y1="236.14583"
x2="109.80209"
y2="199.10417" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ecedea"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="1.5270238"
inkscape:cx="402.76179"
inkscape:cy="151.43033"
inkscape:document-units="mm"
inkscape:current-layer="layer2"
showgrid="true"
showguides="true"
inkscape:window-width="1916"
inkscape:window-height="1041"
inkscape:window-x="0"
inkscape:window-y="18"
inkscape:window-maximized="0"
fit-margin-top="10"
inkscape:pagecheckerboard="false">
<inkscape:grid
type="xygrid"
id="grid3780" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer2"
inkscape:label="layer"
style="display:inline"
transform="translate(0,-197)"
inkscape:groupmode="layer">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="87.181389"
y="259.77109"
id="clangd"><tspan
sodipodi:role="line"
id="tspan6291"
x="87.181389"
y="259.77109"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:25.39999962px;font-family:'Noto Sans Mono';-inkscape-font-specification:'Noto Sans Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332">clangd</tspan></text>
<g
style="display:inline"
id="CD"
inkscape:label="CD">
<path
id="C"
style="display:inline;fill:url(#radialGradient6314);fill-opacity:1;stroke:#055f25;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 63.5,225.5625 H 50.270837 c -13.229167,0 -26.458334,6.61458 -26.458334,26.45834 0,19.84374 13.229167,26.55586 26.599104,26.50658 L 63.5,278.47922 l 4e-5,-13.22917 H 50.270837 c 0,0 -12.705299,1e-4 -12.964614,-13.09685 -0.264553,-13.36153 12.964614,-13.36153 12.964614,-13.36153 H 63.5 Z"
inkscape:connector-curvature="0"
sodipodi:nodetypes="czsscccsccc"
inkscape:export-xdpi="387.07999"
inkscape:export-ydpi="387.07999"
inkscape:label="C" />
<path
id="D"
style="fill:url(#linearGradient6316);fill-opacity:1;stroke:#0d386b;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 64.82292,212.33333 h 10.58333 c 0.62363,0 1.32292,0.69929 1.32292,1.32292 v 50.27083 c 0,0.62363 -0.69929,1.32292 -1.32292,1.32292 H 63.5 50.270837 c 0,0 -12.612556,-1.5e-4 -12.924189,-13.37203 -0.304978,-13.0863 12.924189,-13.0863 12.924189,-13.0863 H 63.5 v -25.13542 c 0,-0.62363 0.69929,-1.32292 1.32292,-1.32292 z"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssccccsccss"
inkscape:label="D" />
</g>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:14.11111069px;line-height:1.25;font-family:'Noto Sans Mono';-inkscape-font-specification:'Noto Sans Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;display:inline;opacity:1;fill:#5d5d5d;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="133.1293"
y="277.50995"
id="subtitle"
inkscape:label="subtitle"><tspan
sodipodi:role="line"
id="tspan4561"> </tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
logo/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 B

BIN
logo/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

138
logo/logo.svg Normal file
View File

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="svg8"
version="1.1"
viewBox="0 0 54.916668 68.194359"
height="68.194359mm"
width="54.916668mm">
<defs
id="defs2">
<linearGradient
id="linearGradient6203">
<stop
style="stop-color:#f0f8a0;stop-opacity:1"
offset="0"
id="stop6201" />
<stop
id="stop6272"
offset="0.75"
style="stop-color:#c1e0a4;stop-opacity:1;" />
<stop
style="stop-color:#5aab7b;stop-opacity:1"
offset="1"
id="stop6199" />
</linearGradient>
<linearGradient
id="linearGradient6195">
<stop
id="stop6191"
offset="0"
style="stop-color:#0f5499;stop-opacity:1" />
<stop
id="stop6193"
offset="1"
style="stop-color:#0ed6ff;stop-opacity:1" />
</linearGradient>
<linearGradient
osb:paint="solid"
id="linearGradient6119">
<stop
id="stop6117"
offset="0"
style="stop-color:#75af89;stop-opacity:1;" />
</linearGradient>
<linearGradient
gradientTransform="translate(-42.33333,27.781253)"
gradientUnits="userSpaceOnUse"
y2="199.10417"
x2="109.80209"
y1="236.14583"
x1="87.3125"
id="linearGradient6197"
xlink:href="#linearGradient6195" />
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-2.0309823,-8.6890853e-7,7.0332774e-7,-1.6935434,253.83964,637.53298)"
r="20.843767"
fy="230.91721"
fx="93.45755"
cy="230.91721"
cx="93.45755"
id="radialGradient6287"
xlink:href="#linearGradient6203" />
<radialGradient
r="20.843767"
fy="230.91721"
fx="93.45755"
cy="230.91721"
cx="93.45755"
gradientTransform="matrix(-2.0309823,-8.6890853e-7,7.0332774e-7,-1.6935434,253.83964,637.53298)"
gradientUnits="userSpaceOnUse"
id="radialGradient6314"
xlink:href="#linearGradient6203" />
<linearGradient
y2="199.10417"
x2="109.80209"
y1="236.14583"
x1="87.3125"
gradientTransform="translate(-42.33333,27.781253)"
gradientUnits="userSpaceOnUse"
id="linearGradient6316"
xlink:href="#linearGradient6195" />
</defs>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-22.812503,-211.33333)"
style="display:inline"
id="layer2">
<text
id="clangd"
y="259.77109"
x="87.181389"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:25.39999962px;font-family:'Noto Sans Mono';-inkscape-font-specification:'Noto Sans Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332"
y="259.77109"
x="87.181389"
id="tspan6291">clangd</tspan></text>
<g
id="CD"
style="display:inline">
<path
d="M 63.5,225.5625 H 50.270837 c -13.229167,0 -26.458334,6.61458 -26.458334,26.45834 0,19.84374 13.229167,26.55586 26.599104,26.50658 L 63.5,278.47922 l 4e-5,-13.22917 H 50.270837 c 0,0 -12.705299,1e-4 -12.964614,-13.09685 -0.264553,-13.36153 12.964614,-13.36153 12.964614,-13.36153 H 63.5 Z"
style="display:inline;fill:url(#radialGradient6314);fill-opacity:1;stroke:#055f25;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="C" />
<path
d="m 64.82292,212.33333 h 10.58333 c 0.62363,0 1.32292,0.69929 1.32292,1.32292 v 50.27083 c 0,0.62363 -0.69929,1.32292 -1.32292,1.32292 H 63.5 50.270837 c 0,0 -12.612556,-1.5e-4 -12.924189,-13.37203 -0.304978,-13.0863 12.924189,-13.0863 12.924189,-13.0863 H 63.5 v -25.13542 c 0,-0.62363 0.69929,-1.32292 1.32292,-1.32292 z"
style="fill:url(#linearGradient6316);fill-opacity:1;stroke:#0d386b;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="D" />
</g>
<text
id="subtitle"
y="277.50995"
x="133.1293"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:14.11111069px;line-height:1.25;font-family:'Noto Sans Mono';-inkscape-font-specification:'Noto Sans Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;display:inline;opacity:1;fill:#5d5d5d;fill-opacity:1;stroke:none;stroke-width:0.26458332"
xml:space="preserve"><tspan
y="277.50995"
x="137.35988"
id="tspan4561"> </tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -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
View 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)