Skip to content

Add initial Clang-Tidy baseline - #13602

Open
bneradt wants to merge 7 commits into
apache:masterfrom
bneradt:clang-tidy-cleanup
Open

Add initial Clang-Tidy baseline#13602
bneradt wants to merge 7 commits into
apache:masterfrom
bneradt:clang-tidy-cleanup

Conversation

@bneradt

@bneradt bneradt commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Clang-Tidy can catch focused correctness problems that the existing
Clang Static Analyzer does not cover. An explicit check list also keeps
toolchain upgrades from changing the policy unexpectedly.

This patch adds the initial CI configuration and fixes its realloc,
move-lifetime, argument-order, and vector-capacity findings.

Clang-Tidy can catch focused correctness problems that the existing
Clang Static Analyzer does not cover. An explicit check list also keeps
toolchain upgrades from changing the policy unexpectedly.

This patch adds the initial CI configuration and fixes its realloc,
move-lifetime, argument-order, and vector-capacity findings.
Copilot AI lite review requested due to automatic review settings August 28, 2026 17:30
@bneradt bneradt added this to the 11.0.0 milestone Aug 28, 2026
@bneradt bneradt self-assigned this Aug 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

bneradt added 3 commits August 28, 2026 13:56
Incorrect sizeof expressions can silently compute the size of a pointer
instead of its pointee. The current source tree has no such
diagnostics.

This patch enables the focused Clang-Tidy check so CI rejects future
instances.
Views that outlive their backing storage can introduce subtle
use-after-free bugs. Clang-Tidy could not prove that the temporary ATS
view did not own the outbound SNI storage.

This patch returns the SNI through std::string_view directly and enables
the dangling-handle check for future lifetime mistakes.
MgmtByte is a signed byte, so implicit integer promotion can sign-extend
configuration values. The affected settings accept only nonnegative
values, but their conversions did not make that constraint clear.

This patch preserves the byte type where an integer is unnecessary,
converts the in/out policy through an unsigned byte, and enables the
Clang-Tidy check.
Copilot AI review requested due to automatic review settings August 28, 2026 19:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

bneradt added 2 commits August 28, 2026 14:26
Developers using the repository Clang-Tidy configuration did not see
most diagnostics enforced by CI, so failures could first appear after a
change was pushed.

This patch makes the local configuration a superset of the CI policy
while preserving its additional advisory checks.
Single-character searches using string-literal overloads perform more work
than their character-overload equivalents. Five existing searches used
the more general forms.

This patch uses the character overloads and enables the focused
Clang-Tidy check so new instances fail CI.
Copilot AI review requested due to automatic review settings August 28, 2026 19:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

cmcfarlen
cmcfarlen previously approved these changes Aug 28, 2026
On targets where plain char is signed, high-bit cookie names can index
before the validation table. Other bounded byte conversions also
trigger the new CI check.

This patch makes byte signedness explicit for lookup indexes and other
byte-oriented state while preserving the parser helpers' char interface.
Copilot AI review requested due to automatic review settings August 28, 2026 22:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants