11/**
2- * Classes to represent barriers commonly used in dataflow and taint tracking
2+ * Classes to represent barriers commonly used in data flow and taint tracking
33 * configurations.
44 */
55
@@ -11,35 +11,26 @@ private import codeql.rust.controlflow.ControlFlowGraph as Cfg
1111private import codeql.rust.controlflow.CfgNodes as CfgNodes
1212private import codeql.rust.frameworks.stdlib.Builtins as Builtins
1313
14- /**
15- * A node whose type is a numeric or boolean type, which may be an appropriate
16- * taint flow barrier for some queries.
17- */
14+ /** A node whose type is a numeric. */
1815class NumericTypeBarrier extends DataFlow:: Node {
1916 NumericTypeBarrier ( ) {
20- exists ( StructType t , Struct s |
21- t = TypeInference:: inferType ( this .asExpr ( ) ) and
22- s = t .getStruct ( )
23- |
24- s instanceof Builtins:: NumericType or
25- s instanceof Builtins:: Bool
26- )
17+ TypeInference:: inferType ( this .asExpr ( ) ) .( StructType ) .getStruct ( ) instanceof
18+ Builtins:: NumericType
2719 }
2820}
2921
30- /**
31- * A node whose type is an integral (integer) or boolean type, which may be an
32- * appropriate taint flow barrier for some queries.
33- */
34- class IntegralOrBooleanTypeBarrier extends DataFlow:: Node {
35- IntegralOrBooleanTypeBarrier ( ) {
36- exists ( StructType t , Struct s |
37- t = TypeInference:: inferType ( this .asExpr ( ) ) and
38- s = t .getStruct ( )
39- |
40- s instanceof Builtins:: IntegralType or
41- s instanceof Builtins:: Bool
42- )
22+ /** A node whose type is `bool`. */
23+ class BooleanTypeBarrier extends DataFlow:: Node {
24+ BooleanTypeBarrier ( ) {
25+ TypeInference:: inferType ( this .asExpr ( ) ) .( StructType ) .getStruct ( ) instanceof Builtins:: Bool
26+ }
27+ }
28+
29+ /** A node whose type is an integral (integer). */
30+ class IntegralTypeBarrier extends DataFlow:: Node {
31+ IntegralTypeBarrier ( ) {
32+ TypeInference:: inferType ( this .asExpr ( ) ) .( StructType ) .getStruct ( ) instanceof
33+ Builtins:: IntegralType
4334 }
4435}
4536
0 commit comments