Repository navigation
build(clang-tidy): allow increment/decrement in pro-bounds-pointer-arithmetic - #1325
Merged
Merged
Conversation
castler
marked this pull request as ready for review
October 7, 2026 06:22
castler
requested review from
LittleHuba,
bemerybmw,
crimson11,
hoe-jo and
limdor
as code owners
October 7, 2026 06:22
castler
enabled auto-merge
October 7, 2026 06:22
limdor
approved these changes
Oct 7, 2026
…ithmetic Set cppcoreguidelines-pro-bounds-pointer-arithmetic.AllowIncrementDecrementOperators to true. Stepping a pointer or iterator by exactly one with ++/-- is the idiomatic way to walk a range and, unlike arbitrary offsets (p + n, p += n, p[n]), cannot jump out of bounds by a miscomputed amount. Indexing and additive arithmetic remain flagged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables
cppcoreguidelines-pro-bounds-pointer-arithmetic.AllowIncrementDecrementOperators.Plain
++/--is the idiomatic way to iterate a range and cannot skip past the end by a miscomputed offset.p + n,p += nandp[n]stay flagged.Verified locally with clang-tidy 22.1.7: for
++p; p++; p+=1;the check reports 3 warnings with the option off and 1 (p += 1) with it on.Expected effect: removes the
it++loop findings intransaction_log_set.cppandapplication_id_pid_mapping.cpp(4 alerts); other findings are unchanged.