Skip to content

Commit f78f22b

Browse files
committed
review: the function-size gate is run by hand until CI builds mcpp with clang (#729); a generated deploy source is compared after the link only
- ci-linux.yml: the gate step comes out again. The LLVM toolchain job's llvm@20.1.7 self-build has never completed (libc++ 20's std module hides directory_iterator's comparison) and the step reads the resolution line, not the build's exit status; clang-tidy crashed over the partial database. Recorded as #729. - check_function_sizes.sh: a finding is a diagnostic line ending in the bracketed check name; a crash dump no longer reads as a finding. - prepare/plan.cpp: a declared deploy source that an action writes is left to the post-link comparison; at planning it may hold the previous build's bytes.
1 parent 204dd9c commit f78f22b

5 files changed

Lines changed: 33 additions & 19 deletions

File tree

‎.agents/docs/2026-09-27-eight-reports-by-home-and-one-optimisation-plan.md‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,9 +1402,16 @@ each with a phase-local context struct where several of its steps share locals.
14021402
Readings on the final tree: the gate reports no function over 400 lines; the
14031403
seven fixtures are byte-identical to the pre-split binary; AddressSanitizer
14041404
reports nothing over the fixtures and a 20-script e2e subset; the unit suite
1405-
passes. The gate runs in `ci-linux.yml`'s LLVM toolchain job after mcpp builds
1406-
itself with llvm@20.1.7, with clang-tidy from `xim:llvm-tools` at the version
1407-
that wrote the compile database, because it reads that clang's BMIs. The merge
1405+
passes. The gate was wired into `ci-linux.yml`'s LLVM toolchain job, after the
1406+
step that builds mcpp with llvm@20.1.7, and crashed there: that build has
1407+
never completed (libc++ 20's `std` module hides `directory_iterator`'s
1408+
comparison), and the step reads the resolution line rather than the build's
1409+
exit status, so the job reports success on `main` too. The step came out again,
1410+
the gate's finding filter was narrowed to diagnostic lines (the crash dump named
1411+
the check and every file and had read as a finding), and #729 records the step
1412+
and the wiring. The gate resolves clang-tidy from `xim:llvm-tools` at the
1413+
version that wrote the compile database, because it reads that clang's BMIs,
1414+
and is run by hand after `mcpp build --toolchain llvm@22.1.8`. The merge
14081415
of the first pass took `plan.cpp` to 2,505 lines, over the file gate; the
14091416
records half of P13 (`mcpp.lock`, `resolution.json`) moved to `records.cpp`,
14101417
byte-identical on the same fixtures.

‎.github/tools/check_function_sizes.sh‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,16 @@
3030
# A compile database that names BMIs explicitly (-fmodule-file=...), which
3131
# only a build actually produces: `mcpp build --toolchain llvm@22.1.8` writes
3232
# compile_commands.json at the project root. This script does not build it:
33-
# the caller runs that build first (a developer, or ci-linux.yml's LLVM
34-
# toolchain job, which builds mcpp with llvm@20.1.7 before this step).
35-
# check_file_lengths.sh needs no such division because it reads the tree.
33+
# the caller runs that build first. check_file_lengths.sh needs no such
34+
# division because it reads the tree.
35+
#
36+
# NOT IN CI YET. The only CI job that builds mcpp with clang (ci-linux.yml,
37+
# "toolchain: musl + llvm", llvm@20.1.7) does not produce a complete build:
38+
# libc++ 20's `std` module does not make directory_iterator's comparison
39+
# visible, and that step reads the resolution line rather than the build's
40+
# exit status. Over the partial database clang-tidy crashes. The gate is wired
41+
# in once a CI job builds mcpp with clang (mcpp-community/mcpp#729); until
42+
# then it is run by hand after `mcpp build --toolchain llvm@22.1.8`.
3643
#
3744
# clang-tidy itself is not part of the plain xim:llvm payload mcpp resolves
3845
# for `--toolchain llvm@...` (measured: xim-x-llvm/22.1.8/bin has clang,
@@ -150,7 +157,10 @@ rc=$?
150157
# Only findings inside the decomposition's own directory gate the build: a
151158
# bundled third-party header (e.g. modules/libs/src/json/json.hpp) reached
152159
# through one of these files' imports is not this decomposition's to fix.
153-
relevant=$(grep "readability-function-size" "$OUT" | grep -F -e "/$DIR/" -e "/$(basename "$PRIMARY")" || true)
160+
# A finding is a diagnostic line, which ends with the bracketed check name; a
161+
# crash dump also names the check (in its program arguments) together with
162+
# every file path, and must not read as a finding.
163+
relevant=$(grep -E '\[readability-function-size\]$' "$OUT" | grep -F -e "/$DIR/" -e "/$(basename "$PRIMARY")" || true)
154164

155165
if [ -n "$relevant" ]; then
156166
echo "$relevant" >&2

‎.github/workflows/ci-linux.yml‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,6 @@ jobs:
253253
# Restore
254254
sed -i 's/^default = "llvm@20.1.7"/default = "gcc@16.1.0"/' mcpp.toml
255255
256-
# The function-size gate (mcpp#722) reads clang-tidy's own function
257-
# boundaries over the compile database the LLVM build above wrote, so it
258-
# runs here, where mcpp itself was just built with clang. clang-tidy is
259-
# the sibling payload xim:llvm-tools at that clang's version, because it
260-
# reads the BMIs that clang wrote.
261-
- name: "Function-size gate (src/build/prepare, clang-tidy)"
262-
run: |
263-
XLINGS_HOME="$MCPP_HOME/registry" "$XLINGS_BIN" install xim:llvm-tools@20.1.7 -y
264-
bash .github/tools/check_function_sizes.sh
265-
266256
# Integration: the mcpp built from THIS PR's source builds & runs a real
267257
# external C++ project — xlings (openxlings/xlings ships its own mcpp.toml).
268258
# MCPP_VENDORED_XLINGS only supplies the xlings package backend that mcpp

‎CHANGELOG.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
- **`src/build/prepare/` 的阶段函数按其小节拆分(#722)。** 代码逐字移动,不改变语句顺序;七个
7171
夹具的 `resolution.json`、`build.ninja` 与构建数据库输出与拆分前逐字节相同。该目录下没有超过
7272
400 行的函数:`.github/tools/check_function_sizes.sh` 以 clang-tidy 的 `readability-function-size`
73-
在 LLVM 自举构建之后检查,拆分前报告 10 处。`mcpp.lock` 与 `resolution.json` 的写入移入
74-
`records.cpp`。
73+
在以 LLVM 构建得到的编译数据库上检查,拆分前报告 10 处;CI 中尚无能完整构建 mcpp 的 clang 任务,
74+
接入见 #729。`mcpp.lock` 与 `resolution.json` 的写入移入 `records.cpp`。
7575
- **xlings 固定版本为 2026.9.28.1。** 该版本的 interface 协议为 1.2:`update_packages` 按阶段发出
7676
进度事件,interface 能力运行期间写到标准输出的文本不再混入事件流(openxlings/xlings#625)。
7777

‎src/build/prepare/plan.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,14 @@ static std::expected<void, std::string> step13_make_plan(PrepareState& state, Bu
371371
// SPEC-007 R4.3: a declared deploy outranks a search directory's file of
372372
// the same name, and a difference between the two is said here, where
373373
// the user sees it (the post-link placement edge says it only under -v).
374+
// A declared source that an action writes is left to that edge: at
375+
// planning it may still hold the previous build's bytes.
376+
std::set<std::filesystem::path> actionOutputs;
377+
for (auto const& a : ctx.plan.actions)
378+
for (auto const& o : a.outputs)
379+
actionOutputs.insert(std::filesystem::path(o).lexically_normal());
374380
for (auto const& s : ctx.plan.shadowedSearchDirDlls) {
381+
if (actionOutputs.contains(s.declared.lexically_normal())) continue;
375382
std::error_code ec;
376383
if (std::filesystem::is_regular_file(s.declared, ec)
377384
&& !mcpp::build::stage::same_content(s.declared, s.offered))

0 commit comments

Comments
 (0)