Skip to content

Build with Clang in CI and check the verifier with clang-tidy - #131

Open
SwayamInSync wants to merge 10 commits into
mainfrom
ci/clang-host
Open

SwayamInSync wants to merge 10 commits into
mainfrom
ci/clang-host

Conversation

@SwayamInSync

Copy link
Copy Markdown
Owner

Plan item T4 (Clang-hosted build and clang-tidy in CI). Linux CI built the verifier only with GCC, which accepts C++20 features in C++17 code without a warning; Apple Clang rejects some of them, and before 0.1.0 that class of code, with code whose result depended on the order of evaluation, failed 53 tests on macOS, found only there.

Change

  • Clang as host compiler. The Linux assertions job now builds with Clang 18 (-DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18); the release job stays on GCC, so each host compiler builds every change once, and macOS builds with Apple Clang as before.
  • C++20 extensions are errors in a Clang build of clangVerify (-Werror=c++20-extensions, clang/lib/Verify/CMakeLists.txt), locally as in CI.
  • clang-tidy. The assertions job runs clang-tidy --checks='-*,bugprone-use-after-move' --warnings-as-errors='*' over clang/lib/Verify and clang/tools/cpp-verify, with the build's own clang-tidy and compilation database.

What they found

Compiled with Clang and -Wc++20-extensions, the verifier's 36 sources have seven warnings, all captured structured bindings are a C++20 extension: a lambda capturing a name a structured binding introduced, in Passivize.cpp (two), SubobjectBounds.cpp (one), and Verifier.cpp (four, one loop). Each binding is now a named reference (const auto &Name = Entry.first;), and the files compile with -Werror=c++20-extensions. The open PRs' changed sources (#122, #120, #127, #128, #130, and the probe fix) add none; they contain only these seven, which a merge of this PR fixes.

bugprone-use-after-move reports nothing on main. I also ran bugprone-unchecked-optional-access once: its 32 reports are all accesses that a check or an invariant guards (for example rootRegion of a global root always returns a region), so it is not added to CI.

Testing

The three files compile with Clang and -Werror=c++20-extensions (-fsyntax-only with the build's flags); this PR's assertions job is the first Clang-hosted build of the whole tree with the step.

Docs

Release notes, "Testing".

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant