Patching and Upgrading LLVM
xclang builds LLVM's release source with the changes in patches/. The maintainers' step lists are the llvm-patch and llvm-upgrade skills in .claude/skills; this page is the same, for people. What each patch does is in LLVM patches.
The Rules a Patch Follows
- Applied without fuzz.
toolchain/common.tsapplies everypatches/NNNN-name/*.patchin directory order right after unpacking the source, withpatch -p1 -F0 --forward: a patch applies where it was made or the build fails, so a tag's build is exactly its series. - Upstream's fix when there is one, without its tests. A patch is a bridge to an LLVM release that has the fix, and is dropped then.
- A check that fails without it, in tests/toolchain/smoke.ts (or the build system tests), run on every host.
- A README in the patch's directory: what goes wrong and who hit it, what the patch does,
Upstream:(the issue, the PR, their state),From:, andChecked:(how it was verified, with run ids). - Numbers are never reused: 0005, dropped in 23.1.2.5, stays gone.
*.patchfiles are-textin.gitattributes: git does not convert their line endings, and an editor must not either.
Adding One
patches/NNNN-short-name/withNNNN.patch(against the release source, pathsa/…andb/…, asgit diffwrites them) andREADME.md.- Check locally:
patch -p1 -F0 --dry-run -d <llvm-project at llvmorg-<version>> -i patches/NNNN-*/NNNN.patch, and compile the patched file against the release's headers. Do not build LLVM locally. - Add the check to tests/toolchain/smoke.ts, and confirm it on CI on an
exp/<name>branch: a release.yml run with and without the patch, a toolchain without PGO for a quick A/B. - Docs: the table in LLVM patches, and a CHANGELOG Unreleased entry.
- Report or send it upstream when the maintainers agree to; record the link in its README.
Upgrading LLVM
LLVM_VERSIONand the sha256 of every pinned source intoolchain/common.ts, from LLVM's release page.- Each patch: dropped if upstream took it, otherwise regenerated against the new source (
-F0), keeping its number, with its README'sChecked:updated. - Version-specific code:
grep -rn "23\b\|23\.1"over the TypeScript, Starlark, CMake and workflow files, and read each hit (tests/libclang/libclang.ts, the benchmark's compilers, renamed CMake options, the option tables' paths, toolchain/pgo/remap.txt, the Bazel module's library list). - The bootstrap: the previous xclang release, unless a major version needs a newer compiler; then LLVM's own release build, as for 23.1.2.1.
- A full release.yml run on
exp/<llvm version>; the training and the smoke tests are where a new version breaks most. - The first release of the new version is
<version>.1(releasing).
