Skip to content

Commit f3dca95

Browse files
authored
Merge pull request github#11087 from hvitved/dataflow/summary-ctx
Data flow: Add summary/return context to pruning stages 2-4
2 parents e0c8a8e + cde05e1 commit f3dca95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+10826
-7918
lines changed

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll

Lines changed: 282 additions & 214 deletions
Large diffs are not rendered by default.

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll

Lines changed: 282 additions & 214 deletions
Large diffs are not rendered by default.

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll

Lines changed: 282 additions & 214 deletions
Large diffs are not rendered by default.

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll

Lines changed: 282 additions & 214 deletions
Large diffs are not rendered by default.

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,17 @@ private module Cached {
915915
TDataFlowCallNone() or
916916
TDataFlowCallSome(DataFlowCall call)
917917

918+
cached
919+
newtype TParameterPositionOption =
920+
TParameterPositionNone() or
921+
TParameterPositionSome(ParameterPosition pos)
922+
923+
cached
924+
newtype TReturnCtx =
925+
TReturnCtxNone() or
926+
TReturnCtxNoFlowThrough() or
927+
TReturnCtxMaybeFlowThrough(ReturnKindExt kind)
928+
918929
cached
919930
newtype TTypedContent = MkTypedContent(Content c, DataFlowType t) { store(_, c, _, _, t) }
920931

@@ -1304,6 +1315,44 @@ class DataFlowCallOption extends TDataFlowCallOption {
13041315
}
13051316
}
13061317

1318+
/** An optional `ParameterPosition`. */
1319+
class ParameterPositionOption extends TParameterPositionOption {
1320+
string toString() {
1321+
this = TParameterPositionNone() and
1322+
result = "(none)"
1323+
or
1324+
exists(ParameterPosition pos |
1325+
this = TParameterPositionSome(pos) and
1326+
result = pos.toString()
1327+
)
1328+
}
1329+
}
1330+
1331+
/**
1332+
* A return context used to calculate flow summaries in reverse flow.
1333+
*
1334+
* The possible values are:
1335+
*
1336+
* - `TReturnCtxNone()`: no return flow.
1337+
* - `TReturnCtxNoFlowThrough()`: return flow, but flow through is not possible.
1338+
* - `TReturnCtxMaybeFlowThrough(ReturnKindExt kind)`: return flow, of kind `kind`, and
1339+
* flow through may be possible.
1340+
*/
1341+
class ReturnCtx extends TReturnCtx {
1342+
string toString() {
1343+
this = TReturnCtxNone() and
1344+
result = "(none)"
1345+
or
1346+
this = TReturnCtxNoFlowThrough() and
1347+
result = "(no flow through)"
1348+
or
1349+
exists(ReturnKindExt kind |
1350+
this = TReturnCtxMaybeFlowThrough(kind) and
1351+
result = kind.toString()
1352+
)
1353+
}
1354+
}
1355+
13071356
/** A `Content` tagged with the type of a containing object. */
13081357
class TypedContent extends MkTypedContent {
13091358
private Content c;

0 commit comments

Comments
 (0)