File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed
cpp/ql/lib/semmle/code/cpp/ir/implementation Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -2142,6 +2142,33 @@ class ChiInstruction extends Instruction {
2142
2142
final predicate isPartialUpdate ( ) { Construction:: chiOnlyPartiallyUpdatesLocation ( this ) }
2143
2143
}
2144
2144
2145
+ /**
2146
+ * An instruction that initializes a set of allocations that are each assigned
2147
+ * the same "virtual variable".
2148
+ *
2149
+ * As an example, consider the following snippet:
2150
+ * ```
2151
+ * int a;
2152
+ * int b;
2153
+ * int* p;
2154
+ * if(b) {
2155
+ * p = &a;
2156
+ * } else {
2157
+ * p = &b;
2158
+ * }
2159
+ * *p = 5;
2160
+ * int x = a;
2161
+ * ```
2162
+ *
2163
+ * Since both the address of `a` and `b` reach `p` at `*p = 5` the IR alias
2164
+ * analysis will create a region that contains both `a` and `b`. The region
2165
+ * containing both `a` and `b` are initialized by an `InitializeGroup`
2166
+ * instruction in the entry block of the enclosing function.
2167
+ */
2168
+ class InitializeGroupInstruction extends Instruction {
2169
+ InitializeGroupInstruction ( ) { this .getOpcode ( ) instanceof Opcode:: InitializeGroup }
2170
+ }
2171
+
2145
2172
/**
2146
2173
* An instruction representing unreachable code.
2147
2174
*
Original file line number Diff line number Diff line change @@ -2142,6 +2142,33 @@ class ChiInstruction extends Instruction {
2142
2142
final predicate isPartialUpdate ( ) { Construction:: chiOnlyPartiallyUpdatesLocation ( this ) }
2143
2143
}
2144
2144
2145
+ /**
2146
+ * An instruction that initializes a set of allocations that are each assigned
2147
+ * the same "virtual variable".
2148
+ *
2149
+ * As an example, consider the following snippet:
2150
+ * ```
2151
+ * int a;
2152
+ * int b;
2153
+ * int* p;
2154
+ * if(b) {
2155
+ * p = &a;
2156
+ * } else {
2157
+ * p = &b;
2158
+ * }
2159
+ * *p = 5;
2160
+ * int x = a;
2161
+ * ```
2162
+ *
2163
+ * Since both the address of `a` and `b` reach `p` at `*p = 5` the IR alias
2164
+ * analysis will create a region that contains both `a` and `b`. The region
2165
+ * containing both `a` and `b` are initialized by an `InitializeGroup`
2166
+ * instruction in the entry block of the enclosing function.
2167
+ */
2168
+ class InitializeGroupInstruction extends Instruction {
2169
+ InitializeGroupInstruction ( ) { this .getOpcode ( ) instanceof Opcode:: InitializeGroup }
2170
+ }
2171
+
2145
2172
/**
2146
2173
* An instruction representing unreachable code.
2147
2174
*
You can’t perform that action at this time.
0 commit comments