diff options
author | Sven Boemer <sbomer@gmail.com> | 2022-05-31 22:55:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-31 22:55:22 +0300 |
commit | 6f57bf9ef26214f86bb5c9532a2abbdce2a12c6d (patch) | |
tree | 85ad535008b905fb5e80b4bde457fa6e07af2bc9 /src/ILLink.RoslynAnalyzer/DataFlow/LocalDataFlowVisitor.cs | |
parent | 79b5653ccfd0663790b4dc4efe65c1285ede73fc (diff) |
Don't crash analyzer for ref-return assignment (#2810)
* Don't crash analyzer for ref-return assignment
* Same for flow capture references
* Adjust tests after merge
* PR feedback
Add issue links to tests
Diffstat (limited to 'src/ILLink.RoslynAnalyzer/DataFlow/LocalDataFlowVisitor.cs')
-rw-r--r-- | src/ILLink.RoslynAnalyzer/DataFlow/LocalDataFlowVisitor.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ILLink.RoslynAnalyzer/DataFlow/LocalDataFlowVisitor.cs b/src/ILLink.RoslynAnalyzer/DataFlow/LocalDataFlowVisitor.cs index a99db8a4d..4f16f1b0c 100644 --- a/src/ILLink.RoslynAnalyzer/DataFlow/LocalDataFlowVisitor.cs +++ b/src/ILLink.RoslynAnalyzer/DataFlow/LocalDataFlowVisitor.cs @@ -180,6 +180,16 @@ namespace ILLink.RoslynAnalyzer.DataFlow // Assignment to 'this' is not tracked currently. // Not relevant for trimming dataflow. break; + case IInvocationOperation: + // This can happen for an assignment to a ref return. Skip for now. + // The analyzer doesn't handle refs yet. This should be fixed once the analyzer + // also produces warnings for ref params/locals/returns. + // https://github.com/dotnet/linker/issues/2632 + // https://github.com/dotnet/linker/issues/2158 + break; + // Keep these cases in sync with those in CapturedReferenceValue, for any that + // can show up in a flow capture reference (for example, where the right-hand side + // is a null-coalescing operator). default: // NoneOperation represents operations which are unimplemented by Roslyn // (don't have specific I*Operation types), such as pointer dereferences. |