Address review comments

This commit is contained in:
Tom Hvitved
2026-03-04 14:51:30 +01:00
parent 4474e252fe
commit db491fc985
3 changed files with 14 additions and 16 deletions

View File

@@ -631,7 +631,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
private newtype TSummaryCtx =
TSummaryCtxNone() or
TSummaryCtxSome(ParamNd p, Typ t, Ap ap, TypOption stored, Boolean mustReturn) {
TSummaryCtxSome(ParamNd p, Typ t, Ap ap, TypOption stored, boolean mustReturn) {
fwdFlowInFlowThrough(p, _, t, ap, stored, mustReturn)
} or
TSummaryCtxSource(Boolean mustEscape)
@@ -1019,9 +1019,9 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
private predicate fwdFlowInFlowThrough(
ParamNd p, CcCall innercc, Typ t, Ap ap, TypOption stored, boolean mustReturn
) {
exists(SummaryCtx outerSummaryCtx |
FwdFlowInThrough::fwdFlowIn(_, _, _, p, _, innercc, outerSummaryCtx, t, ap, stored, _) and
outerSummaryCtx.isValidForFlowThrough(mustReturn)
exists(SummaryCtx summaryCtx |
FwdFlowInThrough::fwdFlowIn(_, _, _, p, _, innercc, summaryCtx, t, ap, stored, _) and
summaryCtx.isValidForFlowThrough(mustReturn)
)
}

View File

@@ -47,11 +47,12 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
}
}
newtype TFlowFeature =
private newtype TFlowFeature =
TFeatureHasSourceCallContext() or
TFeatureHasSinkCallContext() or
TFeatureEqualSourceSinkCallContext() or
TFeatureEscapesSourceCallContext(Boolean strict)
TFeatureEscapesSourceCallContext() or
TFeatureEscapesSourceCallContextOrEqualSourceSinkCallContext()
/** A flow configuration feature for use in `Configuration::getAFeature()`. */
class FlowFeature extends TFlowFeature {
@@ -89,22 +90,16 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
* the sink.
*/
class FeatureEscapesSourceCallContext extends FlowFeature, TFeatureEscapesSourceCallContext {
FeatureEscapesSourceCallContext() { this = TFeatureEscapesSourceCallContext(true) }
override string toString() { result = "FeatureEscapesSourceCallContext" }
}
/**
* A flow configuration feature that is the disjuction of `FeatureEscapesSourceCallContext`
* A flow configuration feature that is the disjunction of `FeatureEscapesSourceCallContext`
* and `FeatureEqualSourceSinkCallContext`.
*/
class FeatureEscapesSourceCallContextOrEqualSourceSinkCallContext extends FlowFeature,
TFeatureEscapesSourceCallContext
TFeatureEscapesSourceCallContextOrEqualSourceSinkCallContext
{
FeatureEscapesSourceCallContextOrEqualSourceSinkCallContext() {
this = TFeatureEscapesSourceCallContext(false)
}
override string toString() {
result = "FeatureEscapesSourceCallContextOrEqualSourceSinkCallContext"
}

View File

@@ -64,7 +64,7 @@ module MakeImplStage1<LocationSig Location, InputSig<Location> Lang> {
predicate hasSourceCallCtx();
predicate hasFeatureEscapesSourceCallContext(boolean nonEmpty);
predicate hasFeatureEscapesSourceCallContext(boolean strict);
predicate hasSinkCallCtx();
@@ -1019,7 +1019,10 @@ module MakeImplStage1<LocationSig Location, InputSig<Location> Lang> {
}
predicate hasFeatureEscapesSourceCallContext(boolean strict) {
Config::getAFeature() = TFeatureEscapesSourceCallContext(strict)
Config::getAFeature() instanceof FeatureEscapesSourceCallContext and strict = true
or
Config::getAFeature() instanceof FeatureEscapesSourceCallContextOrEqualSourceSinkCallContext and
strict = false
}
predicate hasSinkCallCtx() {