Skip to content

Commit ef85329

Browse files
committed
C++: Sync identical files.
1 parent 72679c8 commit ef85329

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/Instruction.qll

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff 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
*

cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff 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
*

0 commit comments

Comments
 (0)