Sync shared files

This commit is contained in:
Asger F
2023-09-01 14:00:28 +02:00
parent 6f19fc2fcd
commit 14c71a351e
2 changed files with 34 additions and 0 deletions

View File

@@ -168,9 +168,20 @@ module ModelInput {
* A unit class for adding additional type model rows from CodeQL models. * A unit class for adding additional type model rows from CodeQL models.
*/ */
class TypeModel extends Unit { class TypeModel extends Unit {
/**
* Holds if any of the other predicates in this class might have a result
* for the given `type`.
*
* The implementation of this predicate should not depend on `DataFlow::Node`.
*/
bindingset[type]
predicate isTypeUsed(string type) { none() }
/** /**
* Gets a data-flow node that is a source of the given `type`. * Gets a data-flow node that is a source of the given `type`.
* *
* Note that `type` should also be included in `isTypeUsed`.
*
* This must not depend on API graphs, but ensures that an API node is generated for * This must not depend on API graphs, but ensures that an API node is generated for
* the source. * the source.
*/ */
@@ -180,6 +191,8 @@ module ModelInput {
* Gets a data-flow node that is a sink of the given `type`, * Gets a data-flow node that is a sink of the given `type`,
* usually because it is an argument passed to a parameter of that type. * usually because it is an argument passed to a parameter of that type.
* *
* Note that `type` should also be included in `isTypeUsed`.
*
* This must not depend on API graphs, but ensures that an API node is generated for * This must not depend on API graphs, but ensures that an API node is generated for
* the sink. * the sink.
*/ */
@@ -188,6 +201,8 @@ module ModelInput {
/** /**
* Gets an API node that is a source or sink of the given `type`. * Gets an API node that is a source or sink of the given `type`.
* *
* Note that `type` should also be included in `isTypeUsed`.
*
* Unlike `getASource` and `getASink`, this may depend on API graphs. * Unlike `getASource` and `getASink`, this may depend on API graphs.
*/ */
API::Node getAnApiNode(string type) { none() } API::Node getAnApiNode(string type) { none() }
@@ -367,6 +382,8 @@ predicate isRelevantType(string type) {
( (
Specific::isTypeUsed(type) Specific::isTypeUsed(type)
or or
any(TypeModel model).isTypeUsed(type)
or
exists(TestAllModels t) exists(TestAllModels t)
) )
or or

View File

@@ -168,9 +168,20 @@ module ModelInput {
* A unit class for adding additional type model rows from CodeQL models. * A unit class for adding additional type model rows from CodeQL models.
*/ */
class TypeModel extends Unit { class TypeModel extends Unit {
/**
* Holds if any of the other predicates in this class might have a result
* for the given `type`.
*
* The implementation of this predicate should not depend on `DataFlow::Node`.
*/
bindingset[type]
predicate isTypeUsed(string type) { none() }
/** /**
* Gets a data-flow node that is a source of the given `type`. * Gets a data-flow node that is a source of the given `type`.
* *
* Note that `type` should also be included in `isTypeUsed`.
*
* This must not depend on API graphs, but ensures that an API node is generated for * This must not depend on API graphs, but ensures that an API node is generated for
* the source. * the source.
*/ */
@@ -180,6 +191,8 @@ module ModelInput {
* Gets a data-flow node that is a sink of the given `type`, * Gets a data-flow node that is a sink of the given `type`,
* usually because it is an argument passed to a parameter of that type. * usually because it is an argument passed to a parameter of that type.
* *
* Note that `type` should also be included in `isTypeUsed`.
*
* This must not depend on API graphs, but ensures that an API node is generated for * This must not depend on API graphs, but ensures that an API node is generated for
* the sink. * the sink.
*/ */
@@ -188,6 +201,8 @@ module ModelInput {
/** /**
* Gets an API node that is a source or sink of the given `type`. * Gets an API node that is a source or sink of the given `type`.
* *
* Note that `type` should also be included in `isTypeUsed`.
*
* Unlike `getASource` and `getASink`, this may depend on API graphs. * Unlike `getASource` and `getASink`, this may depend on API graphs.
*/ */
API::Node getAnApiNode(string type) { none() } API::Node getAnApiNode(string type) { none() }
@@ -367,6 +382,8 @@ predicate isRelevantType(string type) {
( (
Specific::isTypeUsed(type) Specific::isTypeUsed(type)
or or
any(TypeModel model).isTypeUsed(type)
or
exists(TestAllModels t) exists(TestAllModels t)
) )
or or