Skip to content

Commit bbab0e5

Browse files
committed
C#: Convert System.Lazy<> flow to CSV format.
1 parent 9e61dfb commit bbab0e5

File tree

2 files changed

+13
-25
lines changed

2 files changed

+13
-25
lines changed

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

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -546,31 +546,6 @@ class SystemTextStringBuilderFlow extends LibraryTypeDataFlow, SystemTextStringB
546546
}
547547
}
548548

549-
/** Data flow for `System.Lazy<>`. */
550-
class SystemLazyFlow extends LibraryTypeDataFlow, SystemLazyClass {
551-
override predicate callableFlow(
552-
CallableFlowSource source, AccessPath sourceAp, CallableFlowSink sink, AccessPath sinkAp,
553-
SourceDeclarationCallable c, boolean preservesValue
554-
) {
555-
preservesValue = true and
556-
exists(SystemFuncDelegateType t, int i | t.getNumberOfTypeParameters() = 1 |
557-
c.(Constructor).getDeclaringType() = this and
558-
c.getParameter(i).getType().getUnboundDeclaration() = t and
559-
source = getDelegateFlowSourceArg(c, i) and
560-
sourceAp = AccessPath::empty() and
561-
sink = TCallableFlowSinkReturn() and
562-
sinkAp = AccessPath::property(this.getValueProperty())
563-
)
564-
or
565-
preservesValue = false and
566-
c = this.getValueProperty().getGetter() and
567-
source = TCallableFlowSourceQualifier() and
568-
sourceAp = AccessPath::empty() and
569-
sink = TCallableFlowSinkReturn() and
570-
sinkAp = AccessPath::empty()
571-
}
572-
}
573-
574549
/** Data flow for `System.Nullable<>`. */
575550
class SystemNullableFlow extends LibraryTypeDataFlow, SystemNullableStruct {
576551
override predicate callableFlow(

csharp/ql/lib/semmle/code/csharp/frameworks/System.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,19 @@ class SystemLazyClass extends SystemUnboundGenericClass {
257257
}
258258
}
259259

260+
/** Data flow for `System.Lazy<>`. */
261+
private class SystemLazyFlowModelCsv extends SummaryModelCsv {
262+
override predicate row(string row) {
263+
row =
264+
[
265+
"System;Lazy<>;false;Lazy;(System.Func<T>);;ReturnValue of Argument[0];Property[System.Lazy<>.Value] of ReturnValue;value",
266+
"System;Lazy<>;false;Lazy;(System.Func<T>,System.Boolean);;ReturnValue of Argument[0];Property[System.Lazy<>.Value] of ReturnValue;value",
267+
"System;Lazy<>;false;Lazy;(System.Func<T>,System.Threading.LazyThreadSafetyMode);;ReturnValue of Argument[0];Property[System.Lazy<>.Value] of ReturnValue;value",
268+
"System;Lazy<>;false;get_Value;();;Argument[-1];ReturnValue;taint",
269+
]
270+
}
271+
}
272+
260273
/** The `System.Nullable<T>` struct. */
261274
class SystemNullableStruct extends SystemUnboundGenericStruct {
262275
SystemNullableStruct() {

0 commit comments

Comments
 (0)