Skip to content

Commit b5a3edf

Browse files
C++: FunctionIR -> IRFunction
1 parent 77c983b commit b5a3edf

34 files changed

+365
-365
lines changed

config/identical-files.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IRVariable.qll",
3636
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRVariable.qll"
3737
],
38-
"C++ IR FunctionIR": [
39-
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/FunctionIR.qll",
40-
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/FunctionIR.qll",
41-
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/FunctionIR.qll"
38+
"C++ IR IRFunction": [
39+
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IRFunction.qll",
40+
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IRFunction.qll",
41+
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRFunction.qll"
4242
],
4343
"C++ IR Operand": [
4444
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Operand.qll",

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IR.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import FunctionIR
1+
import IRFunction
22
import Instruction
33
import IRBlock
44
import IRVariable

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ class IRBlockBase extends TIRBlock {
6363
result = getInstructionCount(this)
6464
}
6565

66-
final FunctionIR getEnclosingFunctionIR() {
67-
result = getFirstInstruction(this).getEnclosingFunctionIR()
66+
final IRFunction getEnclosingIRFunction() {
67+
result = getFirstInstruction(this).getEnclosingIRFunction()
6868
}
6969

7070
final Function getEnclosingFunction() {
@@ -116,7 +116,7 @@ class IRBlock extends IRBlockBase {
116116
* Holds if this block is reachable from the entry point of its function
117117
*/
118118
final predicate isReachableFromFunctionEntry() {
119-
this = getEnclosingFunctionIR().getEntryBlock() or
119+
this = getEnclosingIRFunction().getEntryBlock() or
120120
getAPredecessor().isReachableFromFunctionEntry()
121121
}
122122
}

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/FunctionIR.qll renamed to cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRFunction.qll

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ private import internal.IRInternal
22
import Instruction
33
import cpp
44

5-
private newtype TFunctionIR =
6-
MkFunctionIR(Function func) {
5+
private newtype TIRFunction =
6+
MkIRFunction(Function func) {
77
Construction::functionHasIR(func)
88
}
99

1010
/**
1111
* Represents the IR for a function.
1212
*/
13-
class FunctionIR extends TFunctionIR {
13+
class IRFunction extends TIRFunction {
1414
Function func;
1515

16-
FunctionIR() {
17-
this = MkFunctionIR(func)
16+
IRFunction() {
17+
this = MkIRFunction(func)
1818
}
1919

2020
final string toString() {
@@ -40,33 +40,33 @@ class FunctionIR extends TFunctionIR {
4040
*/
4141
pragma[noinline]
4242
final EnterFunctionInstruction getEnterFunctionInstruction() {
43-
result.getEnclosingFunctionIR() = this
43+
result.getEnclosingIRFunction() = this
4444
}
4545

4646
/**
4747
* Gets the exit point for this function.
4848
*/
4949
pragma[noinline]
5050
final ExitFunctionInstruction getExitFunctionInstruction() {
51-
result.getEnclosingFunctionIR() = this
51+
result.getEnclosingIRFunction() = this
5252
}
5353

5454
pragma[noinline]
5555
final UnmodeledDefinitionInstruction getUnmodeledDefinitionInstruction() {
56-
result.getEnclosingFunctionIR() = this
56+
result.getEnclosingIRFunction() = this
5757
}
5858

5959
pragma[noinline]
6060
final UnmodeledUseInstruction getUnmodeledUseInstruction() {
61-
result.getEnclosingFunctionIR() = this
61+
result.getEnclosingIRFunction() = this
6262
}
6363

6464
/**
6565
* Gets the single return instruction for this function.
6666
*/
6767
pragma[noinline]
6868
final ReturnInstruction getReturnInstruction() {
69-
result.getEnclosingFunctionIR() = this
69+
result.getEnclosingIRFunction() = this
7070
}
7171

7272
/**
@@ -75,7 +75,7 @@ class FunctionIR extends TFunctionIR {
7575
*/
7676
pragma[noinline]
7777
final IRReturnVariable getReturnVariable() {
78-
result.getEnclosingFunctionIR() = this
78+
result.getEnclosingIRFunction() = this
7979
}
8080

8181
/**
@@ -90,13 +90,13 @@ class FunctionIR extends TFunctionIR {
9090
* Gets all instructions in this function.
9191
*/
9292
final Instruction getAnInstruction() {
93-
result.getEnclosingFunctionIR() = this
93+
result.getEnclosingIRFunction() = this
9494
}
9595

9696
/**
9797
* Gets all blocks in this function.
9898
*/
9999
final IRBlock getABlock() {
100-
result.getEnclosingFunctionIR() = this
100+
result.getEnclosingIRFunction() = this
101101
}
102102
}

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRVariable.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
private import internal.IRInternal
2-
import FunctionIR
2+
import IRFunction
33
import cpp
44
import semmle.code.cpp.ir.implementation.TempVariableTag
55
private import semmle.code.cpp.ir.internal.IRUtilities
@@ -48,7 +48,7 @@ abstract class IRVariable extends TIRVariable {
4848
/**
4949
* Gets the IR for the function that references this variable.
5050
*/
51-
final FunctionIR getEnclosingFunctionIR() {
51+
final IRFunction getEnclosingIRFunction() {
5252
result.getFunction() = func
5353
}
5454

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
private import internal.IRInternal
2-
import FunctionIR
2+
import IRFunction
33
import IRBlock
44
import IRVariable
55
import Operand
@@ -153,7 +153,7 @@ module InstructionSanity {
153153
query predicate operandAcrossFunctions(Operand operand, Instruction instr, Instruction defInstr) {
154154
operand.getUseInstruction() = instr and
155155
operand.getDefinitionInstruction() = defInstr and
156-
instr.getEnclosingFunctionIR() != defInstr.getEnclosingFunctionIR()
156+
instr.getEnclosingIRFunction() != defInstr.getEnclosingIRFunction()
157157
}
158158

159159
/**
@@ -174,10 +174,10 @@ module InstructionSanity {
174174
*
175175
* This check ensures we don't have too _few_ back edges.
176176
*/
177-
query predicate containsLoopOfForwardEdges(FunctionIR f) {
177+
query predicate containsLoopOfForwardEdges(IRFunction f) {
178178
exists(IRBlock block |
179179
forwardEdge+(block, block) and
180-
block.getEnclosingFunctionIR() = f
180+
block.getEnclosingIRFunction() = f
181181
)
182182
}
183183

@@ -190,7 +190,7 @@ module InstructionSanity {
190190
* This check ensures we don't have too _many_ back edges.
191191
*/
192192
query predicate lostReachability(IRBlock block) {
193-
exists(FunctionIR f, IRBlock entry |
193+
exists(IRFunction f, IRBlock entry |
194194
entry = f.getEntryBlock() and
195195
entry.getASuccessor+() = block and
196196
not forwardEdge+(entry, block) and
@@ -373,14 +373,14 @@ class Instruction extends Construction::TInstruction {
373373
* Gets the function that contains this instruction.
374374
*/
375375
final Function getEnclosingFunction() {
376-
result = getEnclosingFunctionIR().getFunction()
376+
result = getEnclosingIRFunction().getFunction()
377377
}
378378

379379
/**
380-
* Gets the FunctionIR object that contains the IR for this instruction.
380+
* Gets the IRFunction object that contains the IR for this instruction.
381381
*/
382-
final FunctionIR getEnclosingFunctionIR() {
383-
result = Construction::getInstructionEnclosingFunctionIR(this)
382+
final IRFunction getEnclosingIRFunction() {
383+
result = Construction::getInstructionEnclosingIRFunction(this)
384384
}
385385

386386
/**

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Operand.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class Operand extends TOperand {
2525
result = getUseInstruction().getLocation()
2626
}
2727

28-
final FunctionIR getEnclosingFunctionIR() {
29-
result = getUseInstruction().getEnclosingFunctionIR()
28+
final IRFunction getEnclosingIRFunction() {
29+
result = getUseInstruction().getEnclosingIRFunction()
3030
}
3131

3232
/**

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/PrintIR.qll

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ private string getAdditionalBlockProperty(IRBlock block, string key) {
5050
}
5151

5252
private newtype TPrintableIRNode =
53-
TPrintableFunctionIR(FunctionIR funcIR) {
54-
shouldPrintFunction(funcIR.getFunction())
53+
TPrintableIRFunction(IRFunction irFunc) {
54+
shouldPrintFunction(irFunc.getFunction())
5555
} or
5656
TPrintableIRBlock(IRBlock block) {
5757
shouldPrintFunction(block.getEnclosingFunction())
@@ -113,30 +113,30 @@ abstract class PrintableIRNode extends TPrintableIRNode {
113113
}
114114

115115
/**
116-
* An IR graph node representing a `FunctionIR` object.
116+
* An IR graph node representing a `IRFunction` object.
117117
*/
118-
class PrintableFunctionIR extends PrintableIRNode, TPrintableFunctionIR {
119-
FunctionIR funcIR;
118+
class PrintableIRFunction extends PrintableIRNode, TPrintableIRFunction {
119+
IRFunction irFunc;
120120

121-
PrintableFunctionIR() {
122-
this = TPrintableFunctionIR(funcIR)
121+
PrintableIRFunction() {
122+
this = TPrintableIRFunction(irFunc)
123123
}
124124

125125
override string toString() {
126-
result = funcIR.toString()
126+
result = irFunc.toString()
127127
}
128128

129129
override Location getLocation() {
130-
result = funcIR.getLocation()
130+
result = irFunc.getLocation()
131131
}
132132

133133
override string getLabel() {
134-
result = getIdentityString(funcIR.getFunction())
134+
result = getIdentityString(irFunc.getFunction())
135135
}
136136

137137
override int getOrder() {
138-
this = rank[result + 1](PrintableFunctionIR orderedFunc, Location location |
139-
location = orderedFunc.getFunctionIR().getLocation() |
138+
this = rank[result + 1](PrintableIRFunction orderedFunc, Location location |
139+
location = orderedFunc.getIRFunction().getLocation() |
140140
orderedFunc order by location.getFile().getAbsolutePath(), location.getStartLine(),
141141
location.getStartColumn(), orderedFunc.getLabel()
142142
)
@@ -146,8 +146,8 @@ class PrintableFunctionIR extends PrintableIRNode, TPrintableFunctionIR {
146146
none()
147147
}
148148

149-
final FunctionIR getFunctionIR() {
150-
result = funcIR
149+
final IRFunction getIRFunction() {
150+
result = irFunc
151151
}
152152
}
153153

@@ -185,8 +185,8 @@ class PrintableIRBlock extends PrintableIRNode, TPrintableIRBlock {
185185
any()
186186
}
187187

188-
override final PrintableFunctionIR getParent() {
189-
result.getFunctionIR() = block.getEnclosingFunctionIR()
188+
override final PrintableIRFunction getParent() {
189+
result.getIRFunction() = block.getEnclosingIRFunction()
190190
}
191191

192192
override string getProperty(string key) {

0 commit comments

Comments
 (0)