Skip to content

Improve TreeTransform for positional parameter expressions. #575

@secure-sw-dev-bot

Description

@secure-sw-dev-bot

This issue was copied from checkedc/checkedc-clang#576


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:

  1. While debugging an alternative approach, I noticed that TreeTransform
    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.
  2. Clean up and improve some comments in TreeTransform.h.
  3. Improve the parameters for TransformExtendedParameterInfo, marking some
    as const and changing the order of parameters to group related parameters
    together.

Testing:

  • Added new regression test for issue 484.
  • Passed local testing on Windows.
  • Passed automated testing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions