-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Implements more advanced ILLink/ILCompiler analysis for Type.GetMember #94879
Conversation
- Implements masking the required member types based on the MemberTypes parameter
- Matching by name is implemented here, including logic to handle the prefix name lookup scheme of GetMember & special handling for constructors
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsFixes #94745
|
src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs
Outdated
Show resolved
Hide resolved
src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs
Outdated
Show resolved
Hide resolved
src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs
Outdated
Show resolved
Hide resolved
Comment so this doesn't get closed - can someone please review this? Thanks! Edit: sorry for so many commits btw, I'm using VS Code so I only get basic syntax highlighting 😆. |
- We use EndsWith(string) because some platforms don't have the char overload
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas Issue DetailsFixes #94745 Allows narrowing members down by name & by member type.
|
- Update the `[Kept]` attributes on the unit tests to reflect what we should now expect to be kept - Add some more unit tests - Fix missing `| BindingFlags.Static` for the default binding flags
- And add another .IsEmpty check like similar APIs have
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
// Assume a default value for MemberTypes for methods that don't use MemberTypes as a parameter | ||
memberTypes = MemberTypes.All; | ||
// Assume a default value for BindingFlags for methods that don't use BindingFlags as a parameter (Type.DefaultLookup) | ||
bindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the default behavior (looks correct to me). Could we make sure there are tests for this part of the change? So add a test that checks that static methods are kept when not passing binding flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will take a look through this next week some time (away currently).
MemberTypes.Method | | ||
MemberTypes.Property | | ||
MemberTypes.TypeInfo | | ||
MemberTypes.NestedType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also please add test coverage for the various member types (ensure that when MemberTypes are passed, we keep exactly those member types on a reflected type)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't implemented the changes to the tests yet, will close these comments when I do. I want to get the current tests to not fail first, then I'll change them to be what the new code should expect.
src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs
Outdated
Show resolved
Hide resolved
src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs
Outdated
Show resolved
Hide resolved
src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs
Outdated
Show resolved
Hide resolved
src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs
Outdated
Show resolved
Hide resolved
src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs
Outdated
Show resolved
Hide resolved
src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs
Outdated
Show resolved
Hide resolved
- Remove prefix versions of APIs - Remove ignoring of .Custom - Add missing space
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr, @marek-safar Issue DetailsFixes #94745 Allows narrowing members down by name & by member type.
|
- Remove remaining prefix code - Don't call AddReturnValue
src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs
Outdated
Show resolved
Hide resolved
- Implement feedback for .ctor - Remove calls to `AddReturnValue (MultiValueLattice.Top);`, since this returns an array
I'm unable to look at this at the moment, or for another few weeks probably. Will re-open or open a new PR when I'm able to if/when I come back to it. |
Fixes #94745
Allows narrowing members down by name & by member type.