C#: Convert System.Lazy<> flow to CSV format.

This commit is contained in:
Michael Nebel 2021-12-03 13:42:23 +01:00
Родитель 9e61dfb41f
Коммит bbab0e582a
2 изменённых файлов: 13 добавлений и 25 удалений

Просмотреть файл

@ -546,31 +546,6 @@ class SystemTextStringBuilderFlow extends LibraryTypeDataFlow, SystemTextStringB
}
}
/** Data flow for `System.Lazy<>`. */
class SystemLazyFlow extends LibraryTypeDataFlow, SystemLazyClass {
override predicate callableFlow(
CallableFlowSource source, AccessPath sourceAp, CallableFlowSink sink, AccessPath sinkAp,
SourceDeclarationCallable c, boolean preservesValue
) {
preservesValue = true and
exists(SystemFuncDelegateType t, int i | t.getNumberOfTypeParameters() = 1 |
c.(Constructor).getDeclaringType() = this and
c.getParameter(i).getType().getUnboundDeclaration() = t and
source = getDelegateFlowSourceArg(c, i) and
sourceAp = AccessPath::empty() and
sink = TCallableFlowSinkReturn() and
sinkAp = AccessPath::property(this.getValueProperty())
)
or
preservesValue = false and
c = this.getValueProperty().getGetter() and
source = TCallableFlowSourceQualifier() and
sourceAp = AccessPath::empty() and
sink = TCallableFlowSinkReturn() and
sinkAp = AccessPath::empty()
}
}
/** Data flow for `System.Nullable<>`. */
class SystemNullableFlow extends LibraryTypeDataFlow, SystemNullableStruct {
override predicate callableFlow(

Просмотреть файл

@ -257,6 +257,19 @@ class SystemLazyClass extends SystemUnboundGenericClass {
}
}
/** Data flow for `System.Lazy<>`. */
private class SystemLazyFlowModelCsv extends SummaryModelCsv {
override predicate row(string row) {
row =
[
"System;Lazy<>;false;Lazy;(System.Func<T>);;ReturnValue of Argument[0];Property[System.Lazy<>.Value] of ReturnValue;value",
"System;Lazy<>;false;Lazy;(System.Func<T>,System.Boolean);;ReturnValue of Argument[0];Property[System.Lazy<>.Value] of ReturnValue;value",
"System;Lazy<>;false;Lazy;(System.Func<T>,System.Threading.LazyThreadSafetyMode);;ReturnValue of Argument[0];Property[System.Lazy<>.Value] of ReturnValue;value",
"System;Lazy<>;false;get_Value;();;Argument[-1];ReturnValue;taint",
]
}
}
/** The `System.Nullable<T>` struct. */
class SystemNullableStruct extends SystemUnboundGenericStruct {
SystemNullableStruct() {