Improve TreeTransform for positional parameter expressions.#576
Merged
Improve TreeTransform for positional parameter expressions.#576
Conversation
Change the transformation of positional parameters in TreeTransform.h to use the transformed types for parameters. Do this by using the types passed into TransformExtendedParameterInfo. Before this, the code was just transforming the type for the positional parameter based on however types were being transformed., This worked fine for a type-only transform, but didn't work properly when the parameter type was transformed based on some other informaton in the program (such as a bounds-safe interface). This fixes issue #484. Testing: - Add a regression test based on the case described in issue #484.
sulekhark
pushed a commit
that referenced
this pull request
Jul 8, 2021
This requires replacing `%clang_cc1 -verify` with `%clang -Xclang -verify` in the tests that use it. This is one part of the RUN command cleanup that we've wanted to do for a while in #346, and now it is blocking part of #576. This is because the single behavior difference we know of between %clang_cc1 and %clang (other than the need for `-Xclang`) is that %clang_cc1 turns off the system headers, and we want two of our tests that currently use %clang_cc1 to be able to get checked declarations from the system headers. As recently as dac3f97 (August 2020), all of the tests that used %clang_cc1 used -verify. Since then, a few tests have been added that use %clang_cc1 and not -verify. This lends support to my theory that the only reason we used %clang_cc1 was that we were unaware that -verify could be used with %clang via -Xclang, and some subsequently added tests copied the use of %clang_cc1 only because the authors didn't know any better. Thus, I believe that the risk of the migration affecting the validity of the tests (e.g., causing them to falsely pass) is low.
sulekhark
pushed a commit
that referenced
this pull request
Jul 8, 2021
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.
In TreeTransform.h, track the transformed types for parameters. Use
this information to update the types for positional parameter expressions.
This fixes issue #484, which was a typechecking error caused by different types
for uses of parameters in bounds expressions in function types.
The tracking is straightforward: we add a vector of types for parameters.
Positional parameters only occur in bounds expressions in types. When
we transform a function prototype type, we record the transformed types for
parameters before transforming the bounds expressions in the types.
This change also contains a few clean up changes:
had some code that is flagged as specific to template instantiation. It
was mostly code for marking uses. The code in turn called into code that
checked for detecting references to local variables defined in other lexical
contexts (for example, block scopes). Those checks depend on the lexical context
state for Sema. We don't want any of this code running for the kinds
of transforms that we are doing, so I added a new method to TreeTransform.h that
can be overridden to suppress this code.
as const and changing the order of parameters to group related parameters
together.
Testing: