Fix #14863 (tokenizer: add token flag when braces are inserted during simplifications and publish in dumpfile)#8664
Open
danmar wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses #14863 by tracking braces that are inserted by tokenizer simplifications via a new Token flag and exposing that information in the tokenizer dump output.
Changes:
- Add
Token::isInsertedBraceflag and emit it asisInsertedBrace="true"inTokenizer::dump(). - Mark braces as inserted when adding braces during simplification (e.g.,
simplifyAddBracesPair(),elseif()). - Add a unit test that validates the dump contains the inserted-brace marker after
while(a);is simplified.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/testtokenize.cpp | Adds a regression test ensuring the dump output includes isInsertedBrace="true" after brace insertion. |
| lib/tokenize.cpp | Emits the new dump attribute and sets the inserted-brace flag during relevant simplifications. |
| lib/token.h | Introduces the new token flag and repurposes the prior simplified-scope flag into an if/switch/for-init-statement flag. |
| lib/checkother.cpp | Updates logic to use the new flags (isInsertedBrace, isSimplifiedIfInitStmt) instead of the removed isSimplifiedScope. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.