Skip to content

Commit 77abff7

Browse files
authored
Merge pull request #4405 from tamasvajk/feature/lazy-flow
C#: Improve data flow summary for System.Lazy<>
2 parents 339c072 + 3b70064 commit 77abff7

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

csharp/ql/src/semmle/code/csharp/dataflow/LibraryTypeDataFlow.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,13 @@ class SystemLazyFlow extends LibraryTypeDataFlow, SystemLazyClass {
718718
sink = TCallableFlowSinkReturn() and
719719
sinkAp = AccessPath::property(this.getValueProperty())
720720
)
721+
or
722+
preservesValue = false and
723+
c = this.getValueProperty().getGetter() and
724+
source = TCallableFlowSourceQualifier() and
725+
sourceAp = AccessPath::empty() and
726+
sink = TCallableFlowSinkReturn() and
727+
sinkAp = AccessPath::empty()
721728
}
722729
}
723730

csharp/ql/test/library-tests/dataflow/library/LibraryTypeDataFlow.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ callableFlow
442442
| System.Int32.TryParse(string, NumberStyles, IFormatProvider, out int) | argument 0 -> return | false |
443443
| System.Int32.TryParse(string, out int) | argument 0 -> argument 1 | false |
444444
| System.Int32.TryParse(string, out int) | argument 0 -> return | false |
445+
| System.Lazy<>.get_Value() | qualifier -> return | false |
445446
| System.Linq.Enumerable.Aggregate<TSource, TAccumulate, TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, Func<TAccumulate, TResult>) | argument 1 -> parameter 0 of argument 2 | true |
446447
| System.Linq.Enumerable.Aggregate<TSource, TAccumulate, TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, Func<TAccumulate, TResult>) | output from argument 2 -> parameter 0 of argument 3 | true |
447448
| System.Linq.Enumerable.Aggregate<TSource, TAccumulate, TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, Func<TAccumulate, TResult>) | output from argument 3 -> return | true |

0 commit comments

Comments
 (0)