@@ -25,12 +25,18 @@ abstract class PointerArithmeticExpr extends Expr {
2525 abstract Expr getOperand ( ) ;
2626}
2727
28+ /**
29+ * A pointer arithmetic binary operation expression.
30+ */
2831class SimplePointerArithmeticExpr extends PointerArithmeticExpr , PointerArithmeticOperation {
2932 override Expr getPointer ( ) { result = this .getLeftOperand ( ) }
3033
3134 override Expr getOperand ( ) { result = this .getRightOperand ( ) }
3235}
3336
37+ /**
38+ * A pointer arithmetic assignment expression.
39+ */
3440class AssignPointerArithmeticExpr extends PointerArithmeticExpr , AssignOperation {
3541 AssignPointerArithmeticExpr ( ) {
3642 this instanceof AssignPointerAddExpr or
@@ -42,12 +48,18 @@ class AssignPointerArithmeticExpr extends PointerArithmeticExpr, AssignOperation
4248 override Expr getOperand ( ) { result = this .getRValue ( ) }
4349}
4450
51+ /**
52+ * A pointer arithmetic array access expression.
53+ */
4554class ArrayPointerArithmeticExpr extends PointerArithmeticExpr , ArrayExpr {
4655 override Expr getPointer ( ) { result = this .getArrayBase ( ) }
4756
4857 override Expr getOperand ( ) { result = this .getArrayOffset ( ) }
4958}
5059
60+ /**
61+ * An expression which invokes the `offsetof` macro or `__builtin_offsetof` operation.
62+ */
5163class OffsetOfExpr extends Expr {
5264 OffsetOfExpr ( ) {
5365 this instanceof BuiltInOperationBuiltInOffsetOf
@@ -57,7 +69,7 @@ class OffsetOfExpr extends Expr {
5769}
5870
5971/**
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.
6173 */
6274class ArrayCountOfExpr extends ArrayExpr {
6375 ArrayCountOfExpr ( ) {
@@ -77,6 +89,9 @@ class ArrayCountOfExpr extends ArrayExpr {
7789 }
7890}
7991
92+ /**
93+ * An `offsetof` expression or a `sizeof` expression with an operand of a size greater than 1.
94+ */
8095class ScaledIntegerExpr extends Expr {
8196 ScaledIntegerExpr ( ) {
8297 not this .getParent * ( ) instanceof ArrayCountOfExpr and
@@ -90,6 +105,10 @@ class ScaledIntegerExpr extends Expr {
90105 }
91106}
92107
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+ */
93112class ScaledIntegerPointerArithmeticConfig extends DataFlow:: Configuration {
94113 ScaledIntegerPointerArithmeticConfig ( ) { this = "ScaledIntegerPointerArithmeticConfig" }
95114
0 commit comments