File tree Expand file tree Collapse file tree 10 files changed +58
-5
lines changed
cpp/ql/src/semmle/code/cpp/ir
csharp/ql/src/experimental/ir Expand file tree Collapse file tree 10 files changed +58
-5
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,8 @@ private PhiOperandBase phiOperand(
7979}
8080
8181/**
82- * A source operand of an `Instruction`. The operand represents a value consumed by the instruction.
82+ * An operand of an `Instruction`. The operand represents a use of the result of one instruction
83+ * (the defining instruction) in another instruction (the use instruction)
8384 */
8485class Operand extends TOperand {
8586 /** Gets a textual representation of this element. */
Original file line number Diff line number Diff line change @@ -133,6 +133,12 @@ abstract class MemoryLocation extends TMemoryLocation {
133133 predicate isAlwaysAllocatedOnStack ( ) { none ( ) }
134134}
135135
136+ /**
137+ * Represents a set of `MemoryLocation`s that cannot overlap with
138+ * `MemoryLocation`s outside of the set. The `VirtualVariable` will be
139+ * represented by a `MemoryLocation` that totally overlaps all other
140+ * `MemoryLocations` in the set.
141+ */
136142abstract class VirtualVariable extends MemoryLocation { }
137143
138144abstract class AllocationMemoryLocation extends MemoryLocation {
Original file line number Diff line number Diff line change @@ -79,7 +79,8 @@ private PhiOperandBase phiOperand(
7979}
8080
8181/**
82- * A source operand of an `Instruction`. The operand represents a value consumed by the instruction.
82+ * An operand of an `Instruction`. The operand represents a use of the result of one instruction
83+ * (the defining instruction) in another instruction (the use instruction)
8384 */
8485class Operand extends TOperand {
8586 /** Gets a textual representation of this element. */
Original file line number Diff line number Diff line change @@ -79,7 +79,8 @@ private PhiOperandBase phiOperand(
7979}
8080
8181/**
82- * A source operand of an `Instruction`. The operand represents a value consumed by the instruction.
82+ * An operand of an `Instruction`. The operand represents a use of the result of one instruction
83+ * (the defining instruction) in another instruction (the use instruction)
8384 */
8485class Operand extends TOperand {
8586 /** Gets a textual representation of this element. */
Original file line number Diff line number Diff line change @@ -59,6 +59,12 @@ class MemoryLocation extends TMemoryLocation {
5959 final string getUniqueId ( ) { result = var .getUniqueId ( ) }
6060}
6161
62+ /**
63+ * Represents a set of `MemoryLocation`s that cannot overlap with
64+ * `MemoryLocation`s outside of the set. The `VirtualVariable` will be
65+ * represented by a `MemoryLocation` that totally overlaps all other
66+ * `MemoryLocations` in the set.
67+ */
6268class VirtualVariable extends MemoryLocation { }
6369
6470/** A virtual variable that groups all escaped memory within a function. */
Original file line number Diff line number Diff line change @@ -3,18 +3,33 @@ private newtype TOverlap =
33 TMustTotallyOverlap ( ) or
44 TMustExactlyOverlap ( )
55
6+ /**
7+ * Represents a possible overlap between two memory ranges.
8+ */
69abstract class Overlap extends TOverlap {
710 abstract string toString ( ) ;
811}
912
13+ /**
14+ * Represents a partial overlap between two memory ranges, which may or may not
15+ * actually occur in practice.
16+ */
1017class MayPartiallyOverlap extends Overlap , TMayPartiallyOverlap {
1118 final override string toString ( ) { result = "MayPartiallyOverlap" }
1219}
1320
21+ /**
22+ * Represents an overlap in which the first memory range is known to include all
23+ * bits of the second memory range, but may be larger or have a different type.
24+ */
1425class MustTotallyOverlap extends Overlap , TMustTotallyOverlap {
1526 final override string toString ( ) { result = "MustTotallyOverlap" }
1627}
1728
29+ /**
30+ * Represents an overlap between two memory ranges that have the same extent and
31+ * the same type.
32+ */
1833class MustExactlyOverlap extends Overlap , TMustExactlyOverlap {
1934 final override string toString ( ) { result = "MustExactlyOverlap" }
2035}
Original file line number Diff line number Diff line change @@ -79,7 +79,8 @@ private PhiOperandBase phiOperand(
7979}
8080
8181/**
82- * A source operand of an `Instruction`. The operand represents a value consumed by the instruction.
82+ * An operand of an `Instruction`. The operand represents a use of the result of one instruction
83+ * (the defining instruction) in another instruction (the use instruction)
8384 */
8485class Operand extends TOperand {
8586 /** Gets a textual representation of this element. */
Original file line number Diff line number Diff line change @@ -79,7 +79,8 @@ private PhiOperandBase phiOperand(
7979}
8080
8181/**
82- * A source operand of an `Instruction`. The operand represents a value consumed by the instruction.
82+ * An operand of an `Instruction`. The operand represents a use of the result of one instruction
83+ * (the defining instruction) in another instruction (the use instruction)
8384 */
8485class Operand extends TOperand {
8586 /** Gets a textual representation of this element. */
Original file line number Diff line number Diff line change @@ -59,6 +59,12 @@ class MemoryLocation extends TMemoryLocation {
5959 final string getUniqueId ( ) { result = var .getUniqueId ( ) }
6060}
6161
62+ /**
63+ * Represents a set of `MemoryLocation`s that cannot overlap with
64+ * `MemoryLocation`s outside of the set. The `VirtualVariable` will be
65+ * represented by a `MemoryLocation` that totally overlaps all other
66+ * `MemoryLocations` in the set.
67+ */
6268class VirtualVariable extends MemoryLocation { }
6369
6470/** A virtual variable that groups all escaped memory within a function. */
Original file line number Diff line number Diff line change @@ -3,18 +3,33 @@ private newtype TOverlap =
33 TMustTotallyOverlap ( ) or
44 TMustExactlyOverlap ( )
55
6+ /**
7+ * Represents a possible overlap between two memory ranges.
8+ */
69abstract class Overlap extends TOverlap {
710 abstract string toString ( ) ;
811}
912
13+ /**
14+ * Represents a partial overlap between two memory ranges, which may or may not
15+ * actually occur in practice.
16+ */
1017class MayPartiallyOverlap extends Overlap , TMayPartiallyOverlap {
1118 final override string toString ( ) { result = "MayPartiallyOverlap" }
1219}
1320
21+ /**
22+ * Represents an overlap in which the first memory range is known to include all
23+ * bits of the second memory range, but may be larger or have a different type.
24+ */
1425class MustTotallyOverlap extends Overlap , TMustTotallyOverlap {
1526 final override string toString ( ) { result = "MustTotallyOverlap" }
1627}
1728
29+ /**
30+ * Represents an overlap between two memory ranges that have the same extent and
31+ * the same type.
32+ */
1833class MustExactlyOverlap extends Overlap , TMustExactlyOverlap {
1934 final override string toString ( ) { result = "MustExactlyOverlap" }
2035}
You can’t perform that action at this time.
0 commit comments