Age | Commit message (Collapse) | Author |
|
|
|
Fixes https://github.com/dotnet/linker/issues/2888
|
|
Syncing back updates to the shared code from NativeAOT.
Mostly formatting - runtime has enabled an analyzer which requires all members to have visibility assigned explicitly.
Some cleanup.
|
|
Enable CodeQL with TSA
|
|
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
|
|
dependency (#3096)
The tests we have in the linker try to ensure that something can only be kept for a certain reason, but it can be hard to ensure it's not being kept for another reason. For example, sometimes we use typeof(TestType) to mark a type, but that also makes it relevant to variant casting, which can cause parts of TestType to be kept for unintended reasons.
This PR creates the KeptByAttribute which accepts a fully qualified string in Cecil format to indicate depenency provider (the thing that is creating the dependency that marks the item with the attribute), as well as a string representing the DependencyKind to specify the "reason" there was a dependency between the two. It also can accept a System.Type, or a System.Type + name of the member to indicate the dependency provider.
|
|
(#3102)
[main] Update dependencies from dotnet/arcade
|
|
|
|
marked (#3098)
* Don't mark an override every time the base is abstract, only if the declaring type is also marked
Adds a condition to ShouldMarkOverrideForBase to exit early if the declaring type of the method is not marked.
|
|
Changes to processing of compiler generated methods lead to a state where we don't call constant prop and branch removal in all cases before we mark instructions of the method. This can lead to overmarking
This change fixes this by making sure that the branch removal executes on the method in all cases before we mark instructions of the method.
The change guarantees that all accesses to Body are after the constant prop/branch removal happened on the method.
This does have one possibly negative impact: the issue described in https://github.com/dotnet/linker/issues/2937 is now consistent and happens always.
Added tests.
Note that there's still a whole in analysis of compiler generated code around state machines, see https://github.com/dotnet/linker/issues/3087
Basically if there's a local function which is going to be removed due to branch removal and if the body of that method contains code which produces a warning due to generic parameter validation, such warning will always be generated even though it's "dead" code and even if it's suppressed via RUC or similar.
In such case the analysis can't figure out to which method the local function belongs (since the call site has been removed).
|
|
(#3092)
[main] Update dependencies from dotnet/arcade
|
|
(#3091)
|
|
Instead of checking every virtual method to see if it should be kept due
to a base method every iteration of the MarkStep pipeline, check each
method only when its relevant state has changed.
Co-authored-by: Sven Boemer <sbomer@gmail.com>
|
|
* Update CI status in readme
Co-authored-by: Sven Boemer <sbomer@gmail.com>
|
|
`ParameterIndex` struct to index (#3059)
This reverts commit 45e2e5944abc04763263cc1c4b3f9ed86659ae43.
This commit creates a 'ParameterProxy' type and 'ParameterIndex' to represent parameters in a consistent way. This is motivated by using 'int' to represent different ways of counting parameters (sometimes offset by 1 for the 'this' parameter, sometimes not offset). ParameterIndex should now be the only type used to index into a method's parameters. ParameterIndex represents the index of the parameter as it is passed to the method in IL (i.e. 'this' is the 0 index in instance methods). ParameterProxy wraps the common convention of a MethodProxy and int to represent a parameter, and now holds a Method and a ParameterIndex to encapsulate a Parameter.
No behavioral changes are expected from this change.
Co-authored-by: Vitek Karas <10670590+vitek-karas@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
|
|
(#3081)
Don't assume there is only one parameter for set and none for get. Allow DAM on the index parameters of properties.
Co-authored-by: vitek-karas <10670590+vitek-karas@users.noreply.github.com>
Co-authored-by: Sven Boemer <sbomer@gmail.com>
|
|
(#3077)
Change analyzer versions such that the repo can be built with .NET 7 RC2 SDK.
- Took the versions from dotnet/runtime.
- Remove CheckAttributeInstantiation method since is no longer necessary
- Remove global attributes since they are no longer necessary
- Workaround the fact that compiler injects System.Runtime.CompilerServices.RefSafetyRulesAttribute into every assembly to describe the language version
Co-authored-by: tlakollo <tlakaelel_axayakatl@outlook.com>
|
|
(#3079)
[main] Update dependencies from dotnet/arcade
|
|
|
|
[main] Update dependencies from dotnet/runtime
|
|
[main] Update dependencies from dotnet/arcade
|
|
|
|
Remove redundant checks on intrinsicIds
Rename Get<Member>s(BindingFlags) enum variants
Make intrinsicId a required param
Add doc comments for a few intrinsicIds
|
|
|
|
|
|
|
|
(#3049)
[main] Update dependencies from dotnet/runtime
|
|
(#3048)
[main] Update dependencies from dotnet/arcade
|
|
(#3041)
[main] Update dependencies from dotnet/runtime
|
|
(#3040)
[main] Update dependencies from dotnet/arcade
|
|
Adds EventSource events for the start and end of Main() and for the start and end of each call to IStep.Process().
The dotnet/performance scenarios can use ETW events to give a more detailed breakdown of where time is spent. This PR creates a few simple events to be able to track the time the linker takes from process start to end more precisely without any noise from MSBuild. If we want to track more fine-grained details, it will be easy to add them in the future.
LinkerStart is emitted right at the start of Main().
LinkerStop is emitted right before returning from Main().
LinkerStepStart is emitted right before calling IStep.Process.
LinkerStrpStop is emitted right after IStep.Process returns.
|
|
mentions (#3044)
We were lacking validation for some of the warnings, and so change in behavior of the product wasn't reflected in the tests. This cleans up tests for IL2053 and IL2054 (which are not produced anymore).
|
|
* Remove --keep-facades option
|
|
[main] Update dependencies from dotnet/runtime
|
|
[main] Update dependencies from dotnet/arcade
|
|
* Improve warning message for DynamicDependency to include the name of the type along with the name of the member we were looking for.
* Fix tests
|
|
Fixes https://github.com/dotnet/linker/issues/1374
|
|
Use new version of MicrosoftCodeAnalysisVersion in linker (Copy from runtime) to fix the dotnet format command
Run the dotnet format command
Reenable Lint check in ci pipelines
|
|
|
|
Allow codefixer to insert a fix in accessor declarations if we target methods
Fix tests that had accessors and were annotating properties/events
Add tests
|
|
instantiation (#3015)
* Fixes a null ref which happens when an XML comment cref contains generic instantiation
In the cref some of the symbols (for example the type argument) are missing containing symbols, which leads to null refs.
In any case, we should not perform any analysis on symbols inside crefs, only on real code.
So this modifies the analyzer to ignore any symbol inside a cref.
Adds a test to validate this.
* Simplify the test
|
|
Co-authored-by: Matt Galbraith <mattgal@microsoft.com>
|
|
[main] Update dependencies from dotnet/runtime
|
|
The motivation of the change is to reduce the number of unnecessary warnings around PInvokes. The change makes the RequiresReflectionMethodBodyScannerForCallSite check for COM to decide whether dataflow analysis is needed for PInvokes.
|
|
(#3006)
Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk
From Version 7.0.0-beta.22419.1 -> To Version 7.0.0-beta.22426.8
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
|
|
|
|
This change adds ILParameterIndex to represent the IL-based indexing where 0 may refer to this, and SourceParameterIndex where 0 is the first "real" parameter in C# source code. Converting from ILParameterIndex to SourceParameterIndex returns a SourceParameterKind to differentiate between thisand other parameters and ensure that anySourceParameterIndexwill be able to indexMethodReference.Parameters`.
It uses these in ParameterReferenceValue as well as GetMethodParameterValue() and adds a GetMethodThisParameterValue(), ThisParameterReferenceValue, and bubbles the changes where necessary.
Most places should use SourceParameterIndex, and convert to ILParameterIndex when necessary or at the boundary of updated and old code.
|
|
* Update dependencies from https://github.com/dotnet/arcade build 20220805.6
Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk
From Version 7.0.0-beta.22379.10 -> To Version 7.0.0-beta.22405.6
* Update dependencies from https://github.com/dotnet/arcade build 20220811.2
Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk
From Version 7.0.0-beta.22379.10 -> To Version 7.0.0-beta.22411.2
* Update dependencies from https://github.com/dotnet/arcade build 20220818.4
Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk
From Version 7.0.0-beta.22379.10 -> To Version 7.0.0-beta.22418.4
* Update dependencies from https://github.com/dotnet/arcade build 20220819.1
Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk
From Version 7.0.0-beta.22379.10 -> To Version 7.0.0-beta.22419.1
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
|
|
This replaces
https://github.com/dotnet/linker/commit/82c6dc6f82aeb90cfbe509ae07cf539eecb75550
with a different approach. Now SuppressTrimAnalysisWarnings only
suppresses those warnings defined to be part of the "trim analysis"
category, using a separate command-line argument. An exception is 5.0
apps, where the setting continues to suppress specific warnings for
compatibility.
|
|
This includes a sidecar XML file which will suppress new warnings in
the 6.0 framework.
Note that a few of the new warnings for compiler-generated code are
suppressed in 7.0 with attributes on local functions. In the XML I had
to suppress them with an attribute on the user method (since the
signature format doesn't support compiler-generated code).
Also note that this approach only includes suppressions for the core
framework, not OOB assemblies. OOB assemblies or third-party nuget
packages will require a slightly different approach to avoid warnings
about unresolved members referenced in XML, in apps where those
assemblies aren't used. There are no warnings that we need to suppress
in OOB assemblies - only new warnings in already trim-incompatible
code.
This also includes a fix for a varargs method issue I found while
running on the 6.0 framework.
|