Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8bc7e59

Browse files
author
Robert Marsh
committed
autoformat and sync C++ files
1 parent deff5c3 commit 8bc7e59

13 files changed

Lines changed: 66 additions & 62 deletions

File tree

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ class Operand extends TStageOperand {
2828
cached
2929
Operand() {
3030
// Ensure that the operand does not refer to instructions from earlier stages that are unreachable here
31-
exists(Instruction use, Instruction def | this = registerOperand(use, _, def)) or
32-
exists(Instruction use | this = nonSSAMemoryOperand(use, _)) or
31+
exists(Instruction use, Instruction def | this = registerOperand(use, _, def))
32+
or
33+
exists(Instruction use | this = nonSSAMemoryOperand(use, _))
34+
or
3335
exists(Instruction use, Instruction def, IRBlock predecessorBlock |
3436
this = phiOperand(use, def, predecessorBlock, _) or
3537
this = reusedPhiOperand(use, def, predecessorBlock, _)
36-
) or
38+
)
39+
or
3740
exists(Instruction use | this = chiOperand(use, _))
3841
}
3942

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasAnalysis.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ private predicate operandIsConsumedWithoutEscaping(Operand operand) {
9292
instr.(ConvertInstruction).getResultIRType() instanceof IRBooleanType
9393
or
9494
instr instanceof CallInstruction and
95-
not exists(IREscapeAnalysisConfiguration config |
96-
config.useSoundEscapeAnalysis()
97-
)
95+
not exists(IREscapeAnalysisConfiguration config | config.useSoundEscapeAnalysis())
9896
)
9997
)
10098
or

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasConfiguration.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ class DynamicAllocation extends Allocation, TDynamicAllocation {
144144
}
145145

146146
class StageEscapeConfiguration extends string {
147-
StageEscapeConfiguration() {
148-
this = "StageEscapeConfiguration (aliased_ssa)"
149-
}
147+
StageEscapeConfiguration() { this = "StageEscapeConfiguration (aliased_ssa)" }
150148

151149
predicate useSoundEscapeAnalysis() { none() }
152150
}

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasedSSA.qll

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -569,15 +569,13 @@ private Overlap getVariableMemoryLocationOverlap(
569569
* Holds if the def/use information for the result of `instr` can be reused from the previous
570570
* iteration of the IR.
571571
*/
572-
predicate canReuseSSAForOldResult(Instruction instr) {
573-
OldSSA::canReuseSSAForMemoryResult(instr)
574-
}
572+
predicate canReuseSSAForOldResult(Instruction instr) { OldSSA::canReuseSSAForMemoryResult(instr) }
575573

576574
bindingset[result, b]
577575
private boolean unbindBool(boolean b) { result != b.booleanNot() }
578576

579577
MemoryLocation getResultMemoryLocation(Instruction instr) {
580-
not(canReuseSSAForOldResult(instr)) and
578+
not canReuseSSAForOldResult(instr) and
581579
exists(MemoryAccessKind kind, boolean isMayAccess |
582580
kind = instr.getResultMemoryAccess() and
583581
(if instr.hasResultMayMemoryAccess() then isMayAccess = true else isMayAccess = false) and
@@ -610,7 +608,7 @@ MemoryLocation getResultMemoryLocation(Instruction instr) {
610608
}
611609

612610
MemoryLocation getOperandMemoryLocation(MemoryOperand operand) {
613-
not(canReuseSSAForOldResult(operand.getAnyDef())) and
611+
not canReuseSSAForOldResult(operand.getAnyDef()) and
614612
exists(MemoryAccessKind kind, boolean isMayAccess |
615613
kind = operand.getMemoryAccess() and
616614
(if operand.hasMayReadMemoryAccess() then isMayAccess = true else isMayAccess = false) and

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,16 @@ private module Cached {
150150
(
151151
result = getNewInstruction(oldOperand.getAnyDef()) and
152152
overlap = originalOverlap
153-
/*or
154-
exists(OldIR::PhiInputOperand phiOperand, Overlap phiOperandOverlap |
155-
phiOperand = getDegeneratePhiOperand(oldOperand.getAnyDef()) and
156-
result = getNewDefinitionFromOldSSA(phiOperand, phiOperandOverlap) and
157-
overlap = combineOverlap(phiOperandOverlap, originalOverlap)
158-
) */
159-
)
153+
/*
154+
* or
155+
* exists(OldIR::PhiInputOperand phiOperand, Overlap phiOperandOverlap |
156+
* phiOperand = getDegeneratePhiOperand(oldOperand.getAnyDef()) and
157+
* result = getNewDefinitionFromOldSSA(phiOperand, phiOperandOverlap) and
158+
* overlap = combineOverlap(phiOperandOverlap, originalOverlap)
159+
* )
160+
*/
161+
162+
)
160163
)
161164
}
162165

@@ -313,12 +316,13 @@ private module Cached {
313316

314317
cached
315318
Instruction getPhiInstructionBlockStart(PhiInstruction instr) {
316-
exists(OldBlock oldBlock | (
317-
instr = getPhi(oldBlock, _)
318-
or
319-
// Any `Phi` that we propagated from the previous iteration stays in the same block.
320-
getOldInstruction(instr).getBlock() = oldBlock
321-
) and
319+
exists(OldBlock oldBlock |
320+
(
321+
instr = getPhi(oldBlock, _)
322+
or
323+
// Any `Phi` that we propagated from the previous iteration stays in the same block.
324+
getOldInstruction(instr).getBlock() = oldBlock
325+
) and
322326
result = getNewInstruction(oldBlock.getFirstInstruction())
323327
)
324328
}

cpp/ql/src/semmle/code/cpp/ir/implementation/internal/TInstruction.qll

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ module UnaliasedSSAInstructions {
5555
result = TUnaliasedSSAPhiInstruction(blockStartInstr, memoryLocation)
5656
}
5757

58-
TRawInstruction reusedPhiInstruction(
59-
TRawInstruction blockStartInstr) {
60-
none()
61-
}
58+
TRawInstruction reusedPhiInstruction(TRawInstruction blockStartInstr) { none() }
6259

6360
class TChiInstruction = TUnaliasedSSAChiInstruction;
6461

@@ -88,8 +85,7 @@ module AliasedSSAInstructions {
8885
result = TAliasedSSAPhiInstruction(blockStartInstr, memoryLocation)
8986
}
9087

91-
TPhiInstruction reusedPhiInstruction(
92-
TRawInstruction blockStartInstr) {
88+
TPhiInstruction reusedPhiInstruction(TRawInstruction blockStartInstr) {
9389
result = TUnaliasedSSAPhiInstruction(blockStartInstr, _)
9490
}
9591

cpp/ql/src/semmle/code/cpp/ir/implementation/internal/TOperand.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private module Shared {
8484
}
8585
}
8686

87-
/**
87+
/**
8888
* Provides wrappers for the constructors of each branch of `TOperand` that is used by the
8989
* raw IR stage.
9090
* These wrappers are not parameterized because it is not possible to invoke an IPA constructor via
@@ -115,6 +115,7 @@ module RawOperands {
115115
) {
116116
none()
117117
}
118+
118119
/**
119120
* Returns the Chi operand with the specified parameters.
120121
*/
@@ -152,6 +153,7 @@ module UnaliasedSSAOperands {
152153
) {
153154
none()
154155
}
156+
155157
/**
156158
* Returns the Chi operand with the specified parameters.
157159
*/
@@ -195,6 +197,7 @@ module AliasedSSAOperands {
195197
result = Internal::TUnaliasedPhiOperand(useInstr, defInstr, oldBlock, overlap)
196198
)
197199
}
200+
198201
/**
199202
* Returns the Chi operand with the specified parameters.
200203
*/

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ class Operand extends TStageOperand {
2828
cached
2929
Operand() {
3030
// Ensure that the operand does not refer to instructions from earlier stages that are unreachable here
31-
exists(Instruction use, Instruction def | this = registerOperand(use, _, def)) or
32-
exists(Instruction use | this = nonSSAMemoryOperand(use, _)) or
31+
exists(Instruction use, Instruction def | this = registerOperand(use, _, def))
32+
or
33+
exists(Instruction use | this = nonSSAMemoryOperand(use, _))
34+
or
3335
exists(Instruction use, Instruction def, IRBlock predecessorBlock |
3436
this = phiOperand(use, def, predecessorBlock, _) or
3537
this = reusedPhiOperand(use, def, predecessorBlock, _)
36-
) or
38+
)
39+
or
3740
exists(Instruction use | this = chiOperand(use, _))
3841
}
3942

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ class Operand extends TStageOperand {
2828
cached
2929
Operand() {
3030
// Ensure that the operand does not refer to instructions from earlier stages that are unreachable here
31-
exists(Instruction use, Instruction def | this = registerOperand(use, _, def)) or
32-
exists(Instruction use | this = nonSSAMemoryOperand(use, _)) or
31+
exists(Instruction use, Instruction def | this = registerOperand(use, _, def))
32+
or
33+
exists(Instruction use | this = nonSSAMemoryOperand(use, _))
34+
or
3335
exists(Instruction use, Instruction def, IRBlock predecessorBlock |
3436
this = phiOperand(use, def, predecessorBlock, _) or
3537
this = reusedPhiOperand(use, def, predecessorBlock, _)
36-
) or
38+
)
39+
or
3740
exists(Instruction use | this = chiOperand(use, _))
3841
}
3942

cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/AliasAnalysis.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ private predicate operandIsConsumedWithoutEscaping(Operand operand) {
9292
instr.(ConvertInstruction).getResultIRType() instanceof IRBooleanType
9393
or
9494
instr instanceof CallInstruction and
95-
not exists(IREscapeAnalysisConfiguration config |
96-
config.useSoundEscapeAnalysis()
97-
)
95+
not exists(IREscapeAnalysisConfiguration config | config.useSoundEscapeAnalysis())
9896
)
9997
)
10098
or

0 commit comments

Comments
 (0)