@@ -102,6 +102,11 @@ module AccessPath {
102
102
result = singleton ( any ( FieldContent c | c .getField ( ) = f .getUnboundDeclaration ( ) ) )
103
103
}
104
104
105
+ /** Gets a singleton synthetic field access path. */
106
+ AccessPath synthetic ( SyntheticField f ) {
107
+ result = singleton ( any ( SyntheticFieldContent c | c .getField ( ) = f ) )
108
+ }
109
+
105
110
/** Gets an access path representing a property inside a collection. */
106
111
AccessPath properties ( Property p ) { result = TConsAccessPath ( any ( ElementContent c ) , property ( p ) ) }
107
112
}
@@ -1968,9 +1973,7 @@ class SystemThreadingTasksTaskTFlow extends LibraryTypeDataFlow, SystemThreading
1968
1973
source = TCallableFlowSourceQualifier ( ) and
1969
1974
sourceAp = AccessPath:: empty ( ) and
1970
1975
sink = TCallableFlowSinkReturn ( ) and
1971
- sinkAp =
1972
- AccessPath:: field ( any ( SystemRuntimeCompilerServicesTaskAwaiterStruct s )
1973
- .getUnderlyingTaskField ( ) )
1976
+ sinkAp = AccessPath:: synthetic ( any ( SyntheticTaskAwaiterUnderlyingTaskField s ) )
1974
1977
or
1975
1978
// var awaitable = task.ConfigureAwait(false); // <-- new ConfiguredTaskAwaitable<>(task, false)
1976
1979
// // m_configuredTaskAwaiter = new ConfiguredTaskAwaiter(task, false)
@@ -1982,21 +1985,40 @@ class SystemThreadingTasksTaskTFlow extends LibraryTypeDataFlow, SystemThreading
1982
1985
sourceAp = AccessPath:: empty ( ) and
1983
1986
sink = TCallableFlowSinkReturn ( ) and
1984
1987
sinkAp =
1985
- AccessPath:: cons ( any ( FieldContent fc |
1986
- fc .getField ( ) =
1987
- any ( SystemRuntimeCompilerServicesConfiguredTaskAwaitableTStruct t )
1988
- .getUnderlyingAwaiterField ( )
1989
- ) ,
1990
- AccessPath:: field ( any ( SystemRuntimeCompilerServicesConfiguredTaskAwaitableTConfiguredTaskAwaiterStruct s
1991
- ) .getUnderlyingTaskField ( ) ) )
1988
+ AccessPath:: cons ( any ( SyntheticFieldContent sfc |
1989
+ sfc .getField ( ) instanceof SyntheticConfiguredTaskAwaiterField
1990
+ ) , AccessPath:: synthetic ( any ( SyntheticConfiguredTaskAwaitableUnderlyingTaskField s ) ) )
1992
1991
}
1993
1992
1994
1993
override predicate requiresAccessPath ( Content head , AccessPath tail ) {
1995
- head .( FieldContent ) .getField ( ) =
1996
- any ( SystemRuntimeCompilerServicesConfiguredTaskAwaitableTStruct t ) .getUnderlyingAwaiterField ( ) and
1997
- tail =
1998
- AccessPath:: field ( any ( SystemRuntimeCompilerServicesConfiguredTaskAwaitableTConfiguredTaskAwaiterStruct s
1999
- ) .getUnderlyingTaskField ( ) )
1994
+ head .( SyntheticFieldContent ) .getField ( ) instanceof SyntheticConfiguredTaskAwaiterField and
1995
+ tail = AccessPath:: synthetic ( any ( SyntheticConfiguredTaskAwaitableUnderlyingTaskField s ) )
1996
+ }
1997
+ }
1998
+
1999
+ abstract private class SyntheticTaskField extends SyntheticField {
2000
+ bindingset [ this ]
2001
+ SyntheticTaskField ( ) { any ( ) }
2002
+
2003
+ override Type getType ( ) { result instanceof SystemThreadingTasksTaskTClass }
2004
+ }
2005
+
2006
+ private class SyntheticTaskAwaiterUnderlyingTaskField extends SyntheticTaskField {
2007
+ SyntheticTaskAwaiterUnderlyingTaskField ( ) { this = "m_task_task_awaiter" }
2008
+ }
2009
+
2010
+ private class SyntheticConfiguredTaskAwaitableUnderlyingTaskField extends SyntheticTaskField {
2011
+ SyntheticConfiguredTaskAwaitableUnderlyingTaskField ( ) {
2012
+ this = "m_task_configured_task_awaitable"
2013
+ }
2014
+ }
2015
+
2016
+ private class SyntheticConfiguredTaskAwaiterField extends SyntheticField {
2017
+ SyntheticConfiguredTaskAwaiterField ( ) { this = "m_configuredTaskAwaiter" }
2018
+
2019
+ override Type getType ( ) {
2020
+ result instanceof
2021
+ SystemRuntimeCompilerServicesConfiguredTaskAwaitableTConfiguredTaskAwaiterStruct
2000
2022
}
2001
2023
}
2002
2024
@@ -2012,9 +2034,7 @@ private class SystemRuntimeCompilerServicesConfiguredTaskAwaitableTFlow extends
2012
2034
// var result = awaiter.GetResult();
2013
2035
c = this .getGetAwaiterMethod ( ) and
2014
2036
source = TCallableFlowSourceQualifier ( ) and
2015
- sourceAp =
2016
- AccessPath:: field ( any ( SystemRuntimeCompilerServicesConfiguredTaskAwaitableTStruct s )
2017
- .getUnderlyingAwaiterField ( ) ) and
2037
+ sourceAp = AccessPath:: synthetic ( any ( SyntheticConfiguredTaskAwaiterField s ) ) and
2018
2038
sink = TCallableFlowSinkReturn ( ) and
2019
2039
sinkAp = AccessPath:: empty ( ) and
2020
2040
preservesValue = true
@@ -2113,14 +2133,15 @@ class SystemRuntimeCompilerServicesTaskAwaiterFlow extends LibraryTypeDataFlow,
2113
2133
c = this .getGetResultMethod ( ) and
2114
2134
source = TCallableFlowSourceQualifier ( ) and
2115
2135
sourceAp =
2116
- AccessPath:: cons ( any ( FieldContent fc | fc .getField ( ) = this .getUnderlyingTaskField ( ) ) ,
2117
- AccessPath:: property ( any ( SystemThreadingTasksTaskTClass t ) .getResultProperty ( ) ) ) and
2136
+ AccessPath:: cons ( any ( SyntheticFieldContent sfc |
2137
+ sfc .getField ( ) instanceof SyntheticTaskAwaiterUnderlyingTaskField
2138
+ ) , AccessPath:: property ( any ( SystemThreadingTasksTaskTClass t ) .getResultProperty ( ) ) ) and
2118
2139
sink = TCallableFlowSinkReturn ( ) and
2119
2140
sinkAp = AccessPath:: empty ( )
2120
2141
}
2121
2142
2122
2143
override predicate requiresAccessPath ( Content head , AccessPath tail ) {
2123
- head .( FieldContent ) .getField ( ) = this . getUnderlyingTaskField ( ) and
2144
+ head .( SyntheticFieldContent ) .getField ( ) instanceof SyntheticTaskAwaiterUnderlyingTaskField and
2124
2145
tail = AccessPath:: property ( any ( SystemThreadingTasksTaskTClass t ) .getResultProperty ( ) )
2125
2146
}
2126
2147
}
@@ -2139,14 +2160,16 @@ class SystemRuntimeCompilerServicesConfiguredTaskAwaitableTConfiguredTaskAwaiter
2139
2160
c = this .getGetResultMethod ( ) and
2140
2161
source = TCallableFlowSourceQualifier ( ) and
2141
2162
sourceAp =
2142
- AccessPath:: cons ( any ( FieldContent fc | fc .getField ( ) = this .getUnderlyingTaskField ( ) ) ,
2143
- AccessPath:: property ( any ( SystemThreadingTasksTaskTClass t ) .getResultProperty ( ) ) ) and
2163
+ AccessPath:: cons ( any ( SyntheticFieldContent sfc |
2164
+ sfc .getField ( ) instanceof SyntheticConfiguredTaskAwaitableUnderlyingTaskField
2165
+ ) , AccessPath:: property ( any ( SystemThreadingTasksTaskTClass t ) .getResultProperty ( ) ) ) and
2144
2166
sink = TCallableFlowSinkReturn ( ) and
2145
2167
sinkAp = AccessPath:: empty ( )
2146
2168
}
2147
2169
2148
2170
override predicate requiresAccessPath ( Content head , AccessPath tail ) {
2149
- head .( FieldContent ) .getField ( ) = this .getUnderlyingTaskField ( ) and
2171
+ head .( SyntheticFieldContent ) .getField ( ) instanceof
2172
+ SyntheticConfiguredTaskAwaitableUnderlyingTaskField and
2150
2173
tail = AccessPath:: property ( any ( SystemThreadingTasksTaskTClass t ) .getResultProperty ( ) )
2151
2174
}
2152
2175
}
0 commit comments