C#: Convert System.Runtime.CompilerServices.ConfiguredTaskAwaitable flow to CSV format.

This commit is contained in:
Michael Nebel 2021-12-15 09:40:10 +01:00
Родитель 034d45ddc0
Коммит bdd44c1c46
3 изменённых файлов: 10 добавлений и 19 удалений

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

@ -101,6 +101,7 @@ private module Frameworks {
private import semmle.code.csharp.frameworks.system.io.Compression
private import semmle.code.csharp.frameworks.system.Xml
private import semmle.code.csharp.frameworks.system.threading.Tasks
private import semmle.code.csharp.frameworks.system.runtime.CompilerServices
}
/**

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

@ -1391,25 +1391,6 @@ private class SyntheticConfiguredTaskAwaiterField extends SyntheticField {
}
}
/** Data flow for `System.Runtime.CompilerServices.ConfiguredTaskAwaitable<>`. */
private class SystemRuntimeCompilerServicesConfiguredTaskAwaitableTFlow extends LibraryTypeDataFlow,
SystemRuntimeCompilerServicesConfiguredTaskAwaitableTStruct {
override predicate callableFlow(
CallableFlowSource source, AccessPath sourceAp, CallableFlowSink sink, AccessPath sinkAp,
SourceDeclarationCallable c, boolean preservesValue
) {
// var awaitable = task.ConfigureAwait(false);
// var awaiter = awaitable.GetAwaiter(); // <-- awaitable.m_configuredTaskAwaiter
// var result = awaiter.GetResult();
c = this.getGetAwaiterMethod() and
source = TCallableFlowSourceQualifier() and
sourceAp = AccessPath::synthetic(any(SyntheticConfiguredTaskAwaiterField s)) and
sink = TCallableFlowSinkReturn() and
sinkAp = AccessPath::empty() and
preservesValue = true
}
}
/** Data flow for `System.Runtime.CompilerServices.TaskAwaiter<>`. */
class SystemRuntimeCompilerServicesTaskAwaiterFlow extends LibraryTypeDataFlow,
SystemRuntimeCompilerServicesTaskAwaiterStruct {

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

@ -2,6 +2,7 @@
import csharp
private import semmle.code.csharp.frameworks.system.Runtime
private import semmle.code.csharp.dataflow.ExternalFlow
/** The `System.Runtime.CompilerServices` namespace. */
class SystemRuntimeCompilerServicesNamespace extends Namespace {
@ -44,6 +45,14 @@ class SystemRuntimeCompilerServicesConfiguredTaskAwaitableTStruct extends System
}
}
/** Data flow for `System.Runtime.CompilerServices.ConfiguredTaskAwaitable<>`. */
private class SystemRuntimeCompilerServicesConfiguredTaskAwaitableTFlowModelCsv extends SummaryModelCsv {
override predicate row(string row) {
row =
"System.Runtime.CompilerServices;ConfiguredTaskAwaitable<>;false;GetAwaiter;();;SyntheticField[m_configuredTaskAwaiter] of Argument[-1];ReturnValue;value"
}
}
/** The `System.Runtime.CompilerServices.ConfiguredTaskAwaitable<>.ConfiguredTaskAwaiter` struct. */
class SystemRuntimeCompilerServicesConfiguredTaskAwaitableTConfiguredTaskAwaiterStruct extends Struct {
SystemRuntimeCompilerServicesConfiguredTaskAwaitableTConfiguredTaskAwaiterStruct() {