Skip to content

Fix #737 (Refactoring: separate the cppcheck-specific &= handling from TokenList::combineOperators()) - #738

Merged
danmar merged 1 commit into
masterfrom
fix-737
Nov 7, 2026
Merged

danmar merged 1 commit into
masterfrom
fix-737

Conversation

@danmar

@danmar danmar commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

…m TokenList::combineOperators())

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@dmcppcheck dmcppcheck 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.

AI review

I found no problems. The PR is a pure refactoring. The {/} scope tracking and the x&=2 default-parameter heuristic moved out of combineOperators() into two static helpers, updateExecutableScope() and isAnonymousReferenceParameter(). The code was moved without changes. The helpers are called only where the old inline code ran, and the continues happen in the same places. The && short-circuit means the backwards scan still runs only for & outside executable scopes, so performance is the same. simplecpp.h is untouched, so the API stays the same, and the code is valid C++11.

Testing

  • make -j8 testrunner simplecpp CXXOPTS=-Werror in pr/: built with no warnings.
  • ./testrunner: 0 failed (21 skipped, 15 todos).
  • python3 run-tests.py: no failures.
  • python3 -m pytest integration_test.py: 128 passed.
  • ./selfcheck.sh: exit code 0.
  • I built base/ and ran both binaries on scratch/a.cpp. It has &=/& = in these places: free function declarations, a declaration with a body, a member declaration in a struct and in a class with a base list, a qualified A::B&= inside a namespace, a qualified call a::b(c&=d), an initializer f(a&=b), an assignment at file scope, and nested blocks in a function. The output of pr and base is identical (diff is empty), so the behaviour has not changed.

Automated review of acab82a by Claude. The pull request was built and tested locally.

@danmar
danmar merged commit 178e71d into master Nov 7, 2026
47 checks passed
@danmar
danmar deleted the fix-737 branch November 7, 2026 18:18
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.

2 participants