@@ -25,12 +25,18 @@ abstract class PointerArithmeticExpr extends Expr {
25
25
abstract Expr getOperand ( ) ;
26
26
}
27
27
28
+ /**
29
+ * A pointer arithmetic binary operation expression.
30
+ */
28
31
class SimplePointerArithmeticExpr extends PointerArithmeticExpr , PointerArithmeticOperation {
29
32
override Expr getPointer ( ) { result = this .getLeftOperand ( ) }
30
33
31
34
override Expr getOperand ( ) { result = this .getRightOperand ( ) }
32
35
}
33
36
37
+ /**
38
+ * A pointer arithmetic assignment expression.
39
+ */
34
40
class AssignPointerArithmeticExpr extends PointerArithmeticExpr , AssignOperation {
35
41
AssignPointerArithmeticExpr ( ) {
36
42
this instanceof AssignPointerAddExpr or
@@ -42,12 +48,18 @@ class AssignPointerArithmeticExpr extends PointerArithmeticExpr, AssignOperation
42
48
override Expr getOperand ( ) { result = this .getRValue ( ) }
43
49
}
44
50
51
+ /**
52
+ * A pointer arithmetic array access expression.
53
+ */
45
54
class ArrayPointerArithmeticExpr extends PointerArithmeticExpr , ArrayExpr {
46
55
override Expr getPointer ( ) { result = this .getArrayBase ( ) }
47
56
48
57
override Expr getOperand ( ) { result = this .getArrayOffset ( ) }
49
58
}
50
59
60
+ /**
61
+ * An expression which invokes the `offsetof` macro or `__builtin_offsetof` operation.
62
+ */
51
63
class OffsetOfExpr extends Expr {
52
64
OffsetOfExpr ( ) {
53
65
this instanceof BuiltInOperationBuiltInOffsetOf
@@ -57,7 +69,7 @@ class OffsetOfExpr extends Expr {
57
69
}
58
70
59
71
/**
60
- * An array expression conforming to the " arr[ sizeof(arr)/sizeof(arr[ 0 ]) ]" idiom
72
+ * An array expression conforming to the ` arr[sizeof(arr)/sizeof(arr[0])]` idiom.
61
73
*/
62
74
class ArrayCountOfExpr extends ArrayExpr {
63
75
ArrayCountOfExpr ( ) {
@@ -77,6 +89,9 @@ class ArrayCountOfExpr extends ArrayExpr {
77
89
}
78
90
}
79
91
92
+ /**
93
+ * An `offsetof` expression or a `sizeof` expression with an operand of a size greater than 1.
94
+ */
80
95
class ScaledIntegerExpr extends Expr {
81
96
ScaledIntegerExpr ( ) {
82
97
not this .getParent * ( ) instanceof ArrayCountOfExpr and
@@ -90,6 +105,10 @@ class ScaledIntegerExpr extends Expr {
90
105
}
91
106
}
92
107
108
+ /**
109
+ * A data-flow configuration modeling data-flow from a `ScaledIntegerExpr` to a
110
+ * `PointerArithmeticExpr` where the pointer does not point to a 1-byte type.
111
+ */
93
112
class ScaledIntegerPointerArithmeticConfig extends DataFlow:: Configuration {
94
113
ScaledIntegerPointerArithmeticConfig ( ) { this = "ScaledIntegerPointerArithmeticConfig" }
95
114
0 commit comments