Repository navigation
[feature/damAnalyzer] Remove "reflection access pattern" logic from linker - #2447
vitek-karas merged 4 commits into
Conversation
|
I strongly suggest hiding whitespace different to review the |
| @@ -1824,7 +1751,7 @@ bool IsComInterop (IMarshalInfoProvider marshalInfoProvider, TypeReference param | |||
| return false; | |||
| } | |||
|
|
|||
| bool AnalyzeGenericInstantiationTypeArray (in MultiValue arrayParam, ref ReflectionPatternContext reflectionContext, MethodReference calledMethod, IList<GenericParameter> genericParameters) | |||
| bool AnalyzeGenericInstantiationTypeArray (in AnalysisContext context, in MultiValue arrayParam, MethodReference calledMethod, IList<GenericParameter> genericParameters) | |||
There was a problem hiding this comment.
Nit: Maybe we should keep naming it analysisContext to not confuse it with the linker context
tlakollo
left a comment
There was a problem hiding this comment.
I'm not 100% familiar with the calls in which we create a new AnalysisContext and I remember there was a discussion on why they needed an immutable reference for the analysis context which I didn't fully understand but in general, the changes look fine.
|
Before this change the context struct was actually mutable, since we used state in it to track the completeness of all the checks. That's why it was passed around as |
…inker (dotnet/linker#2447) Removes the `IReflectionPatternRecorder` and all related classes. This interface has been introduced at the very beginning of the data flow work in the linker. Back then the purpose of it was to separate the marking logic from diagnostic reporting logic. We thought we would be able to report nice virtual callstacks of warnings and so on. These ideas were superseded by the current design of forcing explicit annotations on method boundaries and thus avoiding the need to report warnings correlated across multiple methods. As such the only consumer of this interface is a "logger" which directly outputs any unrecognized patterns as warnings. The product makes no use of the "Recognized pattern" event at all. The only remaining logic is the ability to suppress diagnostic generation within the data flow logic (typically due to `RequiresUnreferencedCode` attribute on the method). For now I kept this by adding an `AnalysisContext` helper struct to pass around the message origin and diagnostics settings and logging warnings through it. We will likely need an abstraction for diagnostics to be able to share code with the analyzer anyway, so this is probably a step in the right direction. This is almost entirely a mechanical change, in general simplifying the code. Commit migrated from dotnet/linker@077e33b

Removes the
IReflectionPatternRecorderand all related classes. This interface has been introduced at the very beginning of the data flow work in the linker. Back then the purpose of it was to separate the marking logic from diagnostic reporting logic. We thought we would be able to report nice virtual callstacks of warnings and so on. These ideas were superseded by the current design of forcing explicit annotations on method boundaries and thus avoiding the need to report warnings correlated across multiple methods.As such the only consumer of this interface is a "logger" which directly outputs any unrecognized patterns as warnings. The product makes no use of the "Recognized pattern" event at all.
The only remaining logic is the ability to suppress diagnostic generation within the data flow logic (typically due to
RequiresUnreferencedCodeattribute on the method). For now I kept this by adding anAnalysisContexthelper struct to pass around the message origin and diagnostics settings and logging warnings through it. We will likely need an abstraction for diagnostics to be able to share code with the analyzer anyway, so this is probably a step in the right direction.This is almost entirely a mechanical change, in general simplifying the code.