Skip to content

Commit 1a45e10

Browse files
committed
Merge from 'main' to 'sycl-web' (165 commits)
CONFLICT (content): Merge conflict in clang/lib/Frontend/CompilerInvocation.cpp
2 parents 7e97a52 + f7fb52a commit 1a45e10

File tree

689 files changed

+35747
-8541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

689 files changed

+35747
-8541
lines changed
Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
name: Release Binaries
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release-version:
7+
description: 'Release Version'
8+
required: false
9+
type: string
10+
upload:
11+
description: 'Upload binaries to the release page'
12+
required: true
13+
default: false
14+
type: boolean
15+
runs-on:
16+
description: "Runner to use for the build"
17+
required: true
18+
type: choice
19+
# We use ubuntu-22.04 rather than the latest version to make the built
20+
# binaries more portable (eg functional aginast older glibc).
21+
options:
22+
- ubuntu-22.04
23+
- ubuntu-22.04-arm
24+
- macos-13
25+
- macos-14
26+
27+
workflow_call:
28+
inputs:
29+
release-version:
30+
description: 'Release Version'
31+
required: false
32+
type: string
33+
upload:
34+
description: 'Upload binaries to the release page'
35+
required: true
36+
default: false
37+
type: boolean
38+
runs-on:
39+
description: "Runner to use for the build"
40+
required: true
41+
type: string
42+
secrets:
43+
RELEASE_TASKS_USER_TOKEN:
44+
description: "Secret used to check user permissions."
45+
required: false
46+
47+
48+
permissions:
49+
contents: read # Default everything to read-only
50+
51+
jobs:
52+
prepare:
53+
name: Prepare to build binaries
54+
runs-on: ${{ inputs.runs-on }}
55+
if: github.repository_owner == 'llvm'
56+
outputs:
57+
release-version: ${{ steps.vars.outputs.release-version }}
58+
ref: ${{ steps.vars.outputs.ref }}
59+
upload: ${{ steps.vars.outputs.upload }}
60+
target-cmake-flags: ${{ steps.vars.outputs.target-cmake-flags }}
61+
build-flang: ${{ steps.vars.outputs.build-flang }}
62+
release-binary-basename: ${{ steps.vars.outputs.release-binary-basename }}
63+
release-binary-filename: ${{ steps.vars.outputs.release-binary-filename }}
64+
build-runs-on: ${{ steps.vars.outputs.build-runs-on }}
65+
test-runs-on: ${{ steps.vars.outputs.build-runs-on }}
66+
67+
steps:
68+
# It's good practice to use setup-python, but this is also required on macos-14
69+
# due to https://github.com/actions/runner-images/issues/10385
70+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
71+
with:
72+
python-version: '3.13'
73+
74+
- name: Checkout LLVM
75+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
76+
77+
- name: Install Dependencies
78+
shell: bash
79+
run: |
80+
pip install --require-hashes -r ./llvm/utils/git/requirements.txt
81+
82+
- name: Check Permissions
83+
if: github.event_name != 'pull_request'
84+
env:
85+
GITHUB_TOKEN: ${{ github.token }}
86+
USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
87+
shell: bash
88+
run: |
89+
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user "$GITHUB_ACTOR" --user-token "$USER_TOKEN" check-permissions
90+
91+
- name: Collect Variables
92+
id: vars
93+
shell: bash
94+
# In order for the test-release.sh script to run correctly, the LLVM
95+
# source needs to be at the following location relative to the build dir:
96+
# | X.Y.Z-rcN | ./rcN/llvm-project
97+
# | X.Y.Z | ./final/llvm-project
98+
#
99+
# We also need to set divergent flags based on the release version:
100+
# | X.Y.Z-rcN | -rc N -test-asserts
101+
# | X.Y.Z | -final
102+
run: |
103+
trimmed=$(echo ${{ inputs.release-version }} | xargs)
104+
if [ -n "$trimmed" ]; then
105+
release_version="$trimmed"
106+
ref="llvmorg-$release_version"
107+
else
108+
release_version="${{ (github.event_name == 'pull_request' && format('PR{0}', github.event.pull_request.number)) || 'CI'}}-$GITHUB_SHA"
109+
ref="$GITHUB_SHA"
110+
fi
111+
if [ -n "${{ inputs.upload }}" ]; then
112+
upload="${{ inputs.upload }}"
113+
else
114+
upload="false"
115+
fi
116+
echo "release-version=$release_version">> $GITHUB_OUTPUT
117+
echo "ref=$ref" >> $GITHUB_OUTPUT
118+
echo "upload=$upload" >> $GITHUB_OUTPUT
119+
120+
release_binary_basename="LLVM-$release_version-$RUNNER_OS-$RUNNER_ARCH"
121+
echo "release-binary-basename=$release_binary_basename" >> $GITHUB_OUTPUT
122+
echo "release-binary-filename=$release_binary_basename.tar.xz" >> $GITHUB_OUTPUT
123+
124+
target="$RUNNER_OS-$RUNNER_ARCH"
125+
126+
# The macOS builds try to cross compile some libraries so we need to
127+
# add extra CMake args to disable them.
128+
# See https://github.com/llvm/llvm-project/issues/99767
129+
if [ "$RUNNER_OS" = "macOS" ]; then
130+
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF"
131+
if [ "$RUNNER_ARCH" = "ARM64" ]; then
132+
arches=arm64
133+
else
134+
arches=x86_64
135+
# Disable Flang builds on macOS x86_64. The FortranLower library takes
136+
# 2-3 hours to build on macOS, much slower than on Linux.
137+
# The long build time causes the release build to time out on x86_64,
138+
# so we need to disable flang there.
139+
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_PROJECTS='clang;lld;lldb;clang-tools-extra;polly;mlir'"
140+
fi
141+
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
142+
fi
143+
144+
build_flang="true"
145+
146+
if [ "$RUNNER_OS" = "Windows" ]; then
147+
# The build times out on Windows, so we need to disable LTO.
148+
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
149+
fi
150+
151+
echo "target-cmake-flags=$target_cmake_flags" >> $GITHUB_OUTPUT
152+
echo "build-flang=$build_flang" >> $GITHUB_OUTPUT
153+
case "${{ inputs.runs-on }}" in
154+
ubuntu-22.04*)
155+
build_runs_on="depot-${{ inputs.runs-on }}-16"
156+
test_runs_on=$build_runs_on
157+
;;
158+
macos-13)
159+
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
160+
build_runs_on="${{ inputs.runs-on }}"
161+
else
162+
build_runs_on="macos-13-large"
163+
fi
164+
test_runs_on="${{ inputs.runs-on }}"
165+
;;
166+
macos-14)
167+
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
168+
build_runs_on="${{ inputs.runs-on }}"
169+
else
170+
build_runs_on="depot-macos-14"
171+
fi
172+
test_runs_on="${{ inputs.runs-on }}"
173+
;;
174+
*)
175+
test_runs_on="${{ inputs.runs-on }}"
176+
build_runs_on=$test_runs_on
177+
;;
178+
esac
179+
echo "build-runs-on=$build_runs_on" >> $GITHUB_OUTPUT
180+
echo "test-runs-on=$test_runs_on" >> $GITHUB_OUTPUT
181+
182+
build-release-package:
183+
name: "Build Release Package"
184+
needs: prepare
185+
if: github.repository_owner == 'llvm'
186+
runs-on: ${{ needs.prepare.outputs.build-runs-on }}
187+
steps:
188+
189+
- name: Checkout LLVM
190+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
191+
with:
192+
ref: ${{ needs.prepare.outputs.ref }}
193+
194+
- name: Install Ninja
195+
uses: llvm/actions/install-ninja@a1ea791b03c8e61f53a0e66f2f73db283aa0f01e # main
196+
197+
- name: Setup Windows
198+
if: startsWith(runner.os, 'Windows')
199+
uses: llvm/actions/setup-windows@main
200+
with:
201+
arch: amd64
202+
203+
- name: Set Build Prefix
204+
id: setup-stage
205+
shell: bash
206+
run: |
207+
build_prefix=`pwd`
208+
if [ "${{ runner.os }}" = "Linux" ]; then
209+
sudo chown $USER:$USER /mnt/
210+
build_prefix=/mnt/
211+
fi
212+
echo "build-prefix=$build_prefix" >> $GITHUB_OUTPUT
213+
214+
- name: Configure
215+
id: build
216+
shell: bash
217+
run: |
218+
# There were some issues on the ARM64 MacOS runners with trying to build x86 object,
219+
# so we need to set some extra cmake flags to disable this.
220+
cmake -G Ninja -S llvm -B ${{ steps.setup-stage.outputs.build-prefix }}/build \
221+
${{ needs.prepare.outputs.target-cmake-flags }} \
222+
-C clang/cmake/caches/Release.cmake \
223+
-DBOOTSTRAP_BOOTSTRAP_CPACK_PACKAGE_FILE_NAME="${{ needs.prepare.outputs.release-binary-basename }}"
224+
225+
- name: Build
226+
shell: bash
227+
run: |
228+
ninja -v -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-package
229+
release_dir=`find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname 'stage2-bins'`
230+
mv $release_dir/${{ needs.prepare.outputs.release-binary-filename }} .
231+
232+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
233+
with:
234+
name: ${{ runner.os }}-${{ runner.arch }}-release-binary
235+
# Due to path differences on Windows when running in bash vs running on node,
236+
# we need to search for files in the current workspace.
237+
path: |
238+
${{ needs.prepare.outputs.release-binary-filename }}
239+
240+
- name: Run Tests
241+
# These almost always fail so don't let them fail the build and prevent the uploads.
242+
continue-on-error: true
243+
run: |
244+
ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-check-all
245+
246+
upload-release-binaries:
247+
name: "Upload Release Binaries"
248+
needs:
249+
- prepare
250+
- build-release-package
251+
if: >-
252+
github.event_name != 'pull_request' &&
253+
needs.prepare.outputs.upload == 'true'
254+
runs-on: ubuntu-24.04
255+
permissions:
256+
contents: write # For release uploads
257+
id-token: write # For artifact attestations
258+
attestations: write # For artifact attestations
259+
260+
steps:
261+
- name: Checkout Release Scripts
262+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
263+
with:
264+
sparse-checkout: |
265+
llvm/utils/release/github-upload-release.py
266+
llvm/utils/git/requirements.txt
267+
sparse-checkout-cone-mode: false
268+
269+
- name: 'Download artifact'
270+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
271+
with:
272+
pattern: '*-release-binary'
273+
merge-multiple: true
274+
275+
- name: Attest Build Provenance
276+
id: provenance
277+
uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4
278+
with:
279+
subject-path: ${{ needs.prepare.outputs.release-binary-filename }}
280+
281+
- name: Rename attestation file
282+
run:
283+
mv ${{ steps.provenance.outputs.bundle-path }} ${{ needs.prepare.outputs.release-binary-filename }}.jsonl
284+
285+
- name: Upload Build Provenance
286+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
287+
with:
288+
name: ${{ needs.prepare.outputs.release-binary-filename }}-attestation
289+
path: ${{ needs.prepare.outputs.release-binary-filename }}.jsonl
290+
291+
- name: Install Python Requirements
292+
run: |
293+
pip install --require-hashes -r ./llvm/utils/git/requirements.txt
294+
295+
- name: Upload Release
296+
shell: bash
297+
run: |
298+
./llvm/utils/release/github-upload-release.py \
299+
--token ${{ github.token }} \
300+
--release ${{ needs.prepare.outputs.release-version }} \
301+
upload \
302+
--files ${{ needs.prepare.outputs.release-binary-filename }}*

clang-tools-extra/clang-doc/assets/clang-doc-mustache.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ body, html {
396396

397397
.sidebar {
398398
width: 250px;
399-
top: 0;
399+
top: 60px;
400400
left: 0;
401401
height: 100%;
402402
position: fixed;

clang/bindings/python/clang/cindex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3028,7 +3028,7 @@ class _CXUnsavedFile(Structure):
30283028

30293029

30303030
# Functions calls through the python interface are rather slow. Fortunately,
3031-
# for most symboles, we do not need to perform a function call. Their spelling
3031+
# for most symbols, we do not need to perform a function call. Their spelling
30323032
# never changes and is consequently provided by this spelling cache.
30333033
SPELLING_CACHE = {
30343034
# 0: CompletionChunk.Kind("Optional"),

clang/cmake/caches/Release.cmake

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ set(LLVM_RELEASE_ENABLE_LTO THIN CACHE STRING "")
4444
set(LLVM_RELEASE_ENABLE_PGO ON CACHE BOOL "")
4545
set(LLVM_RELEASE_ENABLE_RUNTIMES ${DEFAULT_RUNTIMES} CACHE STRING "")
4646
set(LLVM_RELEASE_ENABLE_PROJECTS ${DEFAULT_PROJECTS} CACHE STRING "")
47+
48+
# This option enables linking stage2 clang statically with the runtimes
49+
# (libc++ and compiler-rt) from stage1. In theory this will give the
50+
# binaries better performance and make them more portable. However,
51+
# this configuration is not well tested and causes build failures with
52+
# the flang-rt tests cases, since the -stclib=libc++ flag does not
53+
# get propagated to the runtimes build. There is also a separate
54+
# issue on Darwin where clang will use the local libc++ headers, but
55+
# link with system libc++ which can cause some incompatibilities.
56+
# See https://github.com/llvm/llvm-project/issues/77653
57+
# Because of these problems, this option will default to OFF.
58+
set(LLVM_RELEASE_ENABLE_LINK_LOCAL_RUNTIMES OFF CACHE BOOL "")
59+
4760
# Note we don't need to add install here, since it is one of the pre-defined
4861
# steps.
4962
set(LLVM_RELEASE_FINAL_STAGE_TARGETS "clang;package;check-all;check-llvm;check-clang" CACHE STRING "")
@@ -55,8 +68,12 @@ set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
5568

5669
set(STAGE1_PROJECTS "clang")
5770

71+
# Need to build compiler-rt in order to use PGO for later stages.
72+
set(STAGE1_RUNTIMES "compiler-rt")
5873
# Build all runtimes so we can statically link them into the stage2 compiler.
59-
set(STAGE1_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind")
74+
if(LLVM_RELEASE_ENABLE_LINK_LOCAL_RUNTIMES)
75+
list(APPEND STAGE1_RUNTIMES "libcxx;libcxxabi;libunwind")
76+
endif()
6077

6178
if (LLVM_RELEASE_ENABLE_PGO)
6279
list(APPEND STAGE1_PROJECTS "lld")
@@ -118,21 +135,25 @@ set_instrument_and_final_stage_var(LLVM_ENABLE_LTO "${LLVM_RELEASE_ENABLE_LTO}"
118135
if (LLVM_RELEASE_ENABLE_LTO)
119136
set_instrument_and_final_stage_var(LLVM_ENABLE_LLD "ON" BOOL)
120137
endif()
121-
set_instrument_and_final_stage_var(LLVM_ENABLE_LIBCXX "ON" BOOL)
122-
set_instrument_and_final_stage_var(LLVM_STATIC_LINK_CXX_STDLIB "ON" BOOL)
123-
set(RELEASE_LINKER_FLAGS "-rtlib=compiler-rt --unwindlib=libunwind")
124-
if(NOT ${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
125-
set(RELEASE_LINKER_FLAGS "${RELEASE_LINKER_FLAGS} -static-libgcc")
138+
if(LLVM_RELEASE_ENABLE_LINK_LOCAL_RUNTIMES)
139+
set_instrument_and_final_stage_var(LLVM_ENABLE_LIBCXX "ON" BOOL)
140+
set_instrument_and_final_stage_var(LLVM_STATIC_LINK_CXX_STDLIB "ON" BOOL)
141+
set(RELEASE_LINKER_FLAGS "-rtlib=compiler-rt --unwindlib=libunwind")
142+
if(NOT ${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
143+
set(RELEASE_LINKER_FLAGS "${RELEASE_LINKER_FLAGS} -static-libgcc")
144+
endif()
126145
endif()
127146

128147
# Set flags for bolt
129148
if (${CMAKE_HOST_SYSTEM_NAME} MATCHES "Linux")
130149
set(RELEASE_LINKER_FLAGS "${RELEASE_LINKER_FLAGS} -Wl,--emit-relocs,-znow")
131150
endif()
132151

133-
set_instrument_and_final_stage_var(CMAKE_EXE_LINKER_FLAGS ${RELEASE_LINKER_FLAGS} STRING)
134-
set_instrument_and_final_stage_var(CMAKE_SHARED_LINKER_FLAGS ${RELEASE_LINKER_FLAGS} STRING)
135-
set_instrument_and_final_stage_var(CMAKE_MODULE_LINKER_FLAGS ${RELEASE_LINKER_FLAGS} STRING)
152+
if (RELEASE_LINKER_FLAGS)
153+
set_instrument_and_final_stage_var(CMAKE_EXE_LINKER_FLAGS ${RELEASE_LINKER_FLAGS} STRING)
154+
set_instrument_and_final_stage_var(CMAKE_SHARED_LINKER_FLAGS ${RELEASE_LINKER_FLAGS} STRING)
155+
set_instrument_and_final_stage_var(CMAKE_MODULE_LINKER_FLAGS ${RELEASE_LINKER_FLAGS} STRING)
156+
endif()
136157

137158
# Final Stage Config (stage2)
138159
set_final_stage_var(LLVM_ENABLE_RUNTIMES "${LLVM_RELEASE_ENABLE_RUNTIMES}" STRING)

clang/docs/AllocToken.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ The default mode to calculate tokens is:
3737
pointers.
3838

3939
Other token ID assignment modes are supported, but they may be subject to
40-
change or removal. These may (experimentally) be selected with ``-mllvm
41-
-alloc-token-mode=<mode>``:
40+
change or removal. These may (experimentally) be selected with ``-Xclang
41+
-falloc-token-mode=<mode>``:
4242

4343
* ``typehash``: This mode assigns a token ID based on the hash of the allocated
4444
type's name.

0 commit comments

Comments
 (0)