Skip to content

fix: resolve clang-tidy findings for the analysis build - #1144

Merged
andiwand merged 2 commits into
mainfrom
review/126-analysis-policy
Oct 6, 2026
Merged

andiwand merged 2 commits into
mainfrom
review/126-analysis-policy

Conversation

@andiwand

@andiwand andiwand commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Fix the clang-tidy findings that remain once ODR_CLANG_TIDY=ON runs the analysis (#1134). Exclude the inheritance-shadowing check that conflicts with typed value handles, and narrowly suppress the template-virtual warning for constant error codes. Check paragraph alignment before dereferencing it in the three XML writers and remove a redundant move into PDF decryption.

Clang-tidy 18, which the CI tidy job runs, loses track of a checked optional after an iterator dereference, a repeated config() call or a loop with a lambda, and reports a [[maybe_unused]] string as unused. Check and dereference one named value instead, keep the JPX alpha component as a pointer, and discard the PDF binary-marker line directly.

The CMake part that ran clang-tidy through the compilation database moved to #1134, because it changes the block that #1134 adds.

Validation: the full library and CLI analysis build passes with clang-tidy 18 in an Ubuntu 24.04 container that matches the tidy job, and with LLVM 22 clang-tidy. 1072 editing, style, OOXML, ODF, PDF, recalculation and HTML tests pass. Path-sensitive analyzer findings remain advisory under the existing policy.

@andiwand
andiwand force-pushed the review/125-http-cleanup-logging branch from c29bd7f to f4f8188 Compare October 6, 2026 13:27
Base automatically changed from review/125-http-cleanup-logging to main October 6, 2026 14:01
andiwand and others added 2 commits October 6, 2026 16:01
The tidy job runs clang-tidy 18, which does not keep an optional checked
across an iterator dereference, a repeated config() call or a loop with
a lambda, and which reports a [[maybe_unused]] string as unused. Check
and dereference one named value instead, keep the JPX alpha component
as a pointer, and discard the PDF binary-marker line directly.

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/126-analysis-policy branch from 9ff0b9f to 22862fd Compare October 6, 2026 14:04
@andiwand andiwand changed the title fix(build): preserve compiler context during static analysis fix: resolve clang-tidy findings for the analysis build Oct 6, 2026
andiwand added a commit that referenced this pull request Oct 6, 2026
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
@andiwand
andiwand merged commit 59edf61 into main Oct 6, 2026
25 checks passed
@andiwand
andiwand deleted the review/126-analysis-policy branch October 6, 2026 14:07
andiwand added a commit that referenced this pull request Oct 6, 2026
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
andiwand added a commit that referenced this pull request Oct 6, 2026
* fix(build): enable clang-tidy before creating targets

* fix(build): keep the Conan source export unchanged

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.

* fix(build): run clang-tidy with the compiler's include paths

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.

* fix: pass clang-tidy 18 on the Type1 and CID width paths

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>
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