Skip to content

Commit 83da76b

Browse files
SteelskinJianhui-Li
authored andcommitted
[ids-check] Update the workflow and script (llvm#199710)
In compnerd/ids#58, support was added to parse a header file using a given source file's flags. This solves many of the issues we had encountered with the `ids-check-helper.py` script and its corresponding workflow. * Update ids to the current version, which includes the `--main-file` changes. * Use a more recent LLVM compiler to build a subset of LLVM. * Build a subset of LLVM targets to properly parse more header files. * Use the `--main-file` argument when invoking `idt`. * Add explicit overrides and exclude header lists. This was tested on every public header in LLVM and forthcoming PRs will land the changes found with the updated script. Once all of the headers have been updated, the workflow will be re-enabled. This effort is tracked in llvm#109483.
1 parent 659071b commit 83da76b

2 files changed

Lines changed: 418 additions & 151 deletions

File tree

.github/workflows/ids-check.yml

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ jobs:
1818
if: github.repository_owner == 'llvm'
1919
name: Check LLVM_ABI annotations with ids
2020
runs-on: ubuntu-24.04
21-
timeout-minutes: 10
21+
timeout-minutes: 20
2222

2323
steps:
2424
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2525
with:
2626
persist-credentials: false
2727
repository: compnerd/ids
2828
path: ${{ github.workspace }}/ids
29-
ref: b3bf35dd13d7ff244a6a6d106fe58d0eedb5743e # main
29+
ref: 6d9b77c89107743159fccaea109e8feb81959844 # main, pinned at the --main-file landing
3030

3131
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3232
with:
@@ -46,41 +46,70 @@ jobs:
4646

4747
- name: Install dependencies
4848
run: |
49-
sudo apt install -y clang-19 ninja-build libclang-19-dev
49+
# Pull a recent clang from LLVM's apt repo so idt's parser stays in
50+
# sync with the C++ language features used by current LLVM source.
51+
sudo install -d -m 0755 /etc/apt/keyrings
52+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key \
53+
| sudo gpg --dearmor -o /etc/apt/keyrings/llvm.gpg
54+
echo "deb [signed-by=/etc/apt/keyrings/llvm.gpg] http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main" \
55+
| sudo tee /etc/apt/sources.list.d/llvm.list
56+
sudo apt update
57+
# oprofile provides opagent.h, used by llvm/ExecutionEngine/OProfileWrapper.h
58+
sudo apt install -y clang-22 lld-22 ninja-build libclang-22-dev oprofile
5059
pip install --require-hashes -r ${{ github.workspace }}/llvm-project/llvm/utils/git/requirements.txt
5160
5261
- name: Configure and build minimal LLVM for use by ids
5362
run: |
5463
cmake -B ${{ github.workspace }}/llvm-project/build/ \
5564
-S ${{ github.workspace }}/llvm-project/llvm/ \
5665
-D CMAKE_BUILD_TYPE=Release \
57-
-D CMAKE_C_COMPILER=clang \
58-
-D CMAKE_CXX_COMPILER=clang++ \
66+
-D CMAKE_C_COMPILER=clang-22 \
67+
-D CMAKE_CXX_COMPILER=clang++-22 \
5968
-D LLVM_ENABLE_PROJECTS=clang \
6069
-D LLVM_TARGETS_TO_BUILD="host" \
70+
-D LLVM_INCLUDE_TESTS=OFF \
71+
-D LLVM_INCLUDE_BENCHMARKS=OFF \
6172
-D CMAKE_EXPORT_COMPILE_COMMANDS=ON \
73+
-D CMAKE_DISABLE_PRECOMPILE_HEADERS=ON \
6274
-G Ninja
63-
cd ${{ github.workspace }}/llvm-project/build/
64-
ninja -t targets all | grep "CommonTableGen: phony$" | grep -v "/" | sed 's/:.*//'
6575
66-
- name: Configure ids
76+
# Build the generated-header prerequisites that idt needs to parse
77+
# LLVM source.
78+
BUILD_DIR=${{ github.workspace }}/llvm-project/build
79+
ninja -C "$BUILD_DIR" \
80+
llvm_vcsrevision_h \
81+
intrinsics_gen omp_gen acc_gen analysis_gen target_parser_gen vt_gen \
82+
DllOptionsTableGen LibOptionsTableGen \
83+
clang-tablegen-targets \
84+
lib/ExecutionEngine/JITLink/COFFOptions.inc
85+
86+
# Build per-target tablegen output for every enabled target.
87+
# Each enabled target exposes a top-level `<Target>CommonTableGen`
88+
# phony rule (e.g. `X86CommonTableGen`); discover them from the
89+
# ninja graph.
90+
TABLEGEN_TARGETS=$(ninja -C "$BUILD_DIR" -t targets all \
91+
| awk -F: '
92+
$2 ~ /phony/ && # phony rules only
93+
$1 !~ /\// && # top-level (skip nested paths)
94+
$1 ~ /CommonTableGen$/ { # per-target tablegen aggregator
95+
print $1
96+
}')
97+
ninja -C "$BUILD_DIR" $TABLEGEN_TARGETS
98+
99+
- name: Configure and build ids
67100
run: |
68101
cmake -B ${{ github.workspace }}/ids/build/ \
69102
-S ${{ github.workspace }}/ids/ \
70103
-D CMAKE_BUILD_TYPE=Release \
71-
-D CMAKE_C_COMPILER=clang \
72-
-D CMAKE_CXX_COMPILER=clang++ \
104+
-D CMAKE_C_COMPILER=clang-22 \
105+
-D CMAKE_CXX_COMPILER=clang++-22 \
73106
-D CMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld \
74-
-D LLVM_DIR=/usr/lib/llvm-19/lib/cmake/llvm/ \
75-
-D Clang_DIR=/usr/lib/llvm-19/lib/cmake/clang/ \
76-
-D FILECHECK_EXECUTABLE=$(which FileCheck-19) \
107+
-D LLVM_DIR=/usr/lib/llvm-22/lib/cmake/llvm/ \
108+
-D Clang_DIR=/usr/lib/llvm-22/lib/cmake/clang/ \
109+
-D FILECHECK_EXECUTABLE=$(which FileCheck-22) \
77110
-D LIT_EXECUTABLE=$(which lit) \
78111
-G Ninja
79-
80-
# TODO: Use an image with a prebuilt idt.
81-
- name: Build ids
82-
run: |
83-
ninja -C ${{ github.workspace }}/ids/build/ all
112+
ninja -C ${{ github.workspace }}/ids/build/
84113
85114
- name: Run ids check
86115
env:
@@ -96,7 +125,8 @@ jobs:
96125
--compile-commands ${{ github.workspace }}/llvm-project/build/compile_commands.json \
97126
--start-rev HEAD~1 \
98127
--end-rev HEAD \
99-
--changed-files "$CHANGED_FILES"
128+
--changed-files "$CHANGED_FILES" \
129+
--verbose
100130
101131
- name: Upload results
102132
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

0 commit comments

Comments
 (0)