C++: Fix IR generation when ConditionDeclExpr
does not have an immediate VariableAccess
#15539
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.
The QLDoc for
ConditionDeclExpr
:made it seem like the first child was always a compiler-generated variable access of the declared variable. However, the test added in the first commit (identified in #15506) shows that this is not always the case.
This PR adds another predicate to
ConditionDeclExpr
for getting the 0'th child without casting it to aVariableAccess
. We then use this new predicate in IR generation instead ofgetVariableAccess
, and this fixes the bug exposed by the first commit.Commit-by-commit review encouraged.