File tree Expand file tree Collapse file tree
cpp/ql/lib/semmle/code/cpp/ir/implementation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2142,6 +2142,33 @@ class ChiInstruction extends Instruction {
21422142 final predicate isPartialUpdate ( ) { Construction:: chiOnlyPartiallyUpdatesLocation ( this ) }
21432143}
21442144
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+
21452172/**
21462173 * An instruction representing unreachable code.
21472174 *
Original file line number Diff line number Diff line change @@ -2142,6 +2142,33 @@ class ChiInstruction extends Instruction {
21422142 final predicate isPartialUpdate ( ) { Construction:: chiOnlyPartiallyUpdatesLocation ( this ) }
21432143}
21442144
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+
21452172/**
21462173 * An instruction representing unreachable code.
21472174 *
You can’t perform that action at this time.
0 commit comments