Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

[DAM analyzer] Add support for properties and enable more tests - #2390

Merged
sbomer merged 7 commits into
dotnet:feature/damAnalyzerfrom
sbomer:propertySupport
Nov 30, 2021
Merged

sbomer merged 7 commits into
dotnet:feature/damAnalyzerfrom
sbomer:propertySupport

Conversation

@sbomer

@sbomer sbomer commented Nov 20, 2021 •

Copy link
Copy Markdown
Member

I enabled more of the dataflow tests for the analyzer and fixed one common bucket of failures due to properties not being supported in the analyzer. The IOperation tree represents properties as IPropertyReferenceOperation so we need to handle properties specially (whereas the linker sees calls to the getter/setter directly).

@sbomer sbomer changed the title Add support for properties and enable more tests [DAM analyzer] Add support for properties and enable more tests Nov 20, 2021
@sbomer
sbomer marked this pull request as ready for review November 29, 2021 19:22
@sbomer
sbomer requested a review from marek-safar as a code owner November 29, 2021 19:22
@sbomer
sbomer requested review from agocke and vitek-karas November 29, 2021 19:22
Comment on lines +43 to +45
// Trimmer and analyzer use different formats for ref parameters
[ExpectedWarning ("IL2077", nameof (ByRefDataflow) + "." + nameof (MethodWithRefParameter) + "(Type&)", ProducedBy = ProducedBy.Trimmer)]
[ExpectedWarning ("IL2077", nameof (ByRefDataflow) + "." + nameof (MethodWithRefParameter) + "(ref Type)", ProducedBy = ProducedBy.Analyzer)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add an issue for this. My understand is that we tried to match the C# formatting in warnings, so if there's a discrepancy, it should be treated as a bug in the linker.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #2406

[ExpectedWarning ("IL2077", nameof (ByRefDataflow) + "." + nameof (MethodWithRefParameter) + "(ref Type)", ProducedBy = ProducedBy.Analyzer)]
public static void PassRefToField ()
{
MethodWithRefParameter (ref s_typeWithPublicParameterlessConstructor);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a general note - I know that linker has issues with ref/out parameters in some cases. We should add a work item to the analyzer about the same.
Basically it reverses data flow direction to a degree....

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the issue you're referring to, right? #2158
I'll link to it from the analyzer tracking issue.

- Rename to 'thisParameter'
- Reference issue about ref parameter formatting
@sbomer sbomer closed this Nov 30, 2021
@sbomer sbomer reopened this Nov 30, 2021
@sbomer

sbomer commented Nov 30, 2021

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@sbomer
sbomer merged commit d8170a8 into dotnet:feature/damAnalyzer Nov 30, 2021
@sbomer sbomer mentioned this pull request Jan 13, 2022
4 tasks done
@sbomer
sbomer deleted the propertySupport branch February 22, 2022 18:13
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
…et/linker#2390)

The IOperation tree represents properties as
IPropertyReferenceOperation, so we need to handle
properties specially (whereas the linker sees calls
to the getter/setter directly).

Commit migrated from dotnet/linker@d8170a8
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants