Skip to content

fix(build): enable clang-tidy before creating targets - #1134

Merged
andiwand merged 4 commits into
mainfrom
review/116-cmake-analysis
Oct 6, 2026
Merged

andiwand merged 4 commits into
mainfrom
review/116-cmake-analysis

Conversation

@andiwand

@andiwand andiwand commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

ODR_CLANG_TIDY=ON previously set a child-directory variable after targets were created, so compilation never ran clang-tidy. Configure it before target creation and fail clearly when the tool is missing. Since CMake 3.25, pass the compilation database to clang-tidy with -p, so it reads the configured compiler's include paths, and copy .clang-tidy into the build directory for generated sources. Remove the unused downstream Conan 1 helper.

With the option working, the CI tidy job runs clang-tidy 18 for real. #1137–#1144 fixed the findings it reports; this PR fixes the last two (an empty catch in the Type1 transform and an optional the CID width loop reads).

Validation: the full library and CLI build passes with clang-tidy 18 in an Ubuntu 24.04 container that matches the tidy job. OFF omits the invocation, and a missing executable fails configuration. 466 font and PDF tests pass.

@andiwand
andiwand force-pushed the review/115-integration-test-concision branch from bdc86c6 to 8e367bc Compare October 6, 2026 12:16
Base automatically changed from review/115-integration-test-concision to main October 6, 2026 12:17
@andiwand
andiwand force-pushed the review/116-cmake-analysis branch from 1adaffa to 663490e Compare October 6, 2026 12:20
andiwand and others added 4 commits October 6, 2026 16:07
The Conan recipe never sets ODR_CLANG_TIDY, so a package build never
runs clang-tidy and does not need .clang-tidy in its sources.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MxyTMutqSUJRGfxA8CyzMc
Since CMake 3.25 the analysis build exports the compilation database and
passes it to clang-tidy with -p, so clang-tidy reads the include paths
of the configured compiler. The policy file is copied into the build
directory, so it also applies to generated sources. This part moved
here from #1144, because it changes the block this PR adds.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MxyTMutqSUJRGfxA8CyzMc
The Type1 fallback glyph is set in the catch, so the catch is not empty.
The CID width loop reads its start once inside an explicit check, because
clang-tidy 18 does not see that a zero count keeps the loop from the
unchecked optional.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MxyTMutqSUJRGfxA8CyzMc
@andiwand
andiwand force-pushed the review/116-cmake-analysis branch from 41ea373 to 09b1397 Compare October 6, 2026 14:19
@andiwand
andiwand marked this pull request as ready for review October 6, 2026 14:19
@andiwand
andiwand merged commit 7f8ff31 into main Oct 6, 2026
30 checks passed
@andiwand
andiwand deleted the review/116-cmake-analysis branch October 6, 2026 14:28
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