Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #12937 FP knownConditionTrueFalse for flags linked by condition #6718

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

chrchr-github
Copy link
Collaborator

@pfultz2 Is there a better way to handle this?

@chrchr-github
Copy link
Collaborator Author

It looks like only operator conditions are flipped correctly in an else block.
This seems to work as well:

const bool isOp = (condTok->isComparisonOp() || condTok->tokType() == Token::eLogicalOp);
const bool is1 = isOp || astIsBool(condTok);
[...]
                    if (is1) {
                        OppositeExpressionAnalyzer a2(true, condTok2, makeConditionValue(isOp, condTok2, false, false, settings), settings);
                        valueFlowGenericForward(startTok, startTok->link(), a2, tokenlist, errorLogger, settings);
                    }

@chrchr-github chrchr-github reopened this Aug 23, 2024
@chrchr-github chrchr-github marked this pull request as ready for review August 23, 2024 19:40
@chrchr-github chrchr-github merged commit 555546e into danmar:main Aug 30, 2024
82 of 119 checks passed
@chrchr-github chrchr-github deleted the chr_12937 branch August 30, 2024 20:12
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