C#: Remove default clears content.

This commit is contained in:
Michael Nebel
2022-05-22 14:51:46 +02:00
parent 5119de8d22
commit ddde1d4607
4 changed files with 6 additions and 25 deletions

View File

@@ -139,28 +139,6 @@ private class RecordConstructorFlow extends SummarizedCallable {
}
}
private class SummarizedCallableDefaultClearsContent extends Impl::Public::SummarizedCallable {
SummarizedCallableDefaultClearsContent() {
this instanceof Impl::Public::SummarizedCallable or none()
}
// By default, we assume that all stores into arguments are definite
override predicate clearsContent(ParameterPosition pos, DataFlow::ContentSet content) {
exists(SummaryComponentStack output, SummaryComponent target |
this.propagatesFlow(_, output, _) and
output.drop(_) =
SummaryComponentStack::push(SummaryComponent::content(content),
SummaryComponentStack::singleton(target)) and
not content instanceof DataFlow::ElementContent
|
target = SummaryComponent::argument(pos.getPosition())
or
target = SummaryComponent::qualifier() and
pos.isThisParameter()
)
}
}
class RequiredSummaryComponentStack = Impl::Public::RequiredSummaryComponentStack;
private class RecordConstructorFlowRequiredSummaryComponentStack extends RequiredSummaryComponentStack {

View File

@@ -933,7 +933,8 @@ module Private {
summaryElement(this, inSpec, outSpec, kind, false)
or
summaryElement(this, inSpec, outSpec, kind, true) and
not summaryElement(this, _, _, _, false)
not summaryElement(this, _, _, _, false) and
not this.clearsContent(_, _)
}
override predicate propagatesFlow(