Skip to content

Commit 7f12f6d

Browse files
committed
C++/C#: format and sync identical files
1 parent 44b6af6 commit 7f12f6d

File tree

6 files changed

+32
-31
lines changed

6 files changed

+32
-31
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,21 +370,19 @@ private module Cached {
370370
then
371371
result = getChi(getOldInstruction(instruction)) and
372372
kind instanceof GotoEdge
373-
else (
373+
else
374374
exists(OldInstruction oldInstruction |
375375
(
376-
oldInstruction = getOldInstruction(instruction)
376+
oldInstruction = getOldInstruction(instruction)
377377
or
378378
instruction = getChi(oldInstruction)
379-
)
380-
and
379+
) and
381380
(
382381
if Reachability::isInfeasibleInstructionSuccessor(oldInstruction, kind)
383382
then result = unreachedInstruction(instruction.getEnclosingIRFunction())
384383
else result = getNewInstruction(oldInstruction.getSuccessor(kind))
385384
)
386385
)
387-
)
388386
}
389387

390388
cached

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ Instruction getPrimaryInstructionForSideEffect(SideEffectInstruction instruction
394394
}
395395

396396
predicate hasUnreachedInstruction(IRFunction func) {
397-
exists(Call c |
397+
exists(Call c |
398398
c.getEnclosingFunction() = func.getFunction() and
399399
any(Options opt).exits(c.getTarget())
400400
)

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ abstract class TranslatedCall extends TranslatedExpr {
6868
or
6969
child = getSideEffects() and
7070
if this.isNoReturn()
71-
then result = any(UnreachedInstruction instr | this.getEnclosingFunction().getFunction() = instr.getEnclosingFunction())
71+
then
72+
result =
73+
any(UnreachedInstruction instr |
74+
this.getEnclosingFunction().getFunction() = instr.getEnclosingFunction()
75+
)
7276
else result = this.getParent().getChildSuccessor(this)
7377
}
7478

@@ -164,9 +168,7 @@ abstract class TranslatedCall extends TranslatedExpr {
164168
*/
165169
abstract predicate hasArguments();
166170

167-
predicate isNoReturn() {
168-
none()
169-
}
171+
predicate isNoReturn() { none() }
170172

171173
final TranslatedSideEffects getSideEffects() { result.getExpr() = expr }
172174
}
@@ -274,9 +276,7 @@ abstract class TranslatedCallExpr extends TranslatedNonConstantExpr, TranslatedC
274276

275277
final override int getNumberOfArguments() { result = expr.getNumberOfArguments() }
276278

277-
final override predicate isNoReturn() {
278-
any(Options opt).exits(expr.getTarget())
279-
}
279+
final override predicate isNoReturn() { any(Options opt).exits(expr.getTarget()) }
280280
}
281281

282282
/**

cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -370,21 +370,19 @@ private module Cached {
370370
then
371371
result = getChi(getOldInstruction(instruction)) and
372372
kind instanceof GotoEdge
373-
else (
373+
else
374374
exists(OldInstruction oldInstruction |
375-
oldInstruction = getOldInstruction(instruction) and
375+
(
376+
oldInstruction = getOldInstruction(instruction)
377+
or
378+
instruction = getChi(oldInstruction)
379+
) and
376380
(
377381
if Reachability::isInfeasibleInstructionSuccessor(oldInstruction, kind)
378382
then result = unreachedInstruction(instruction.getEnclosingIRFunction())
379383
else result = getNewInstruction(oldInstruction.getSuccessor(kind))
380384
)
381385
)
382-
or
383-
exists(OldInstruction oldInstruction |
384-
instruction = getChi(oldInstruction) and
385-
result = getNewInstruction(oldInstruction.getSuccessor(kind))
386-
)
387-
)
388386
}
389387

390388
cached

csharp/ql/src/experimental/ir/implementation/internal/TInstruction.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ newtype TInstruction =
1919
) {
2020
IRConstruction::Raw::hasInstruction(tag1, tag2)
2121
} or
22+
TRawUnreachedInstruction(IRFunctionBase irFunc) {
23+
IRConstruction::hasUnreachedInstruction(irFunc)
24+
} or
2225
TUnaliasedSsaPhiInstruction(
2326
TRawInstruction blockStartInstr, UnaliasedSsa::Ssa::MemoryLocation memoryLocation
2427
) {

csharp/ql/src/experimental/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,13 @@ private module Cached {
3434

3535
cached
3636
predicate hasUnreachedInstructionCached(IRFunction irFunc) {
37-
exists(OldInstruction oldInstruction |
37+
exists(OldIR::Instruction oldInstruction |
3838
irFunc = oldInstruction.getEnclosingIRFunction() and
39-
Reachability::isInfeasibleInstructionSuccessor(oldInstruction, _)
39+
(
40+
Reachability::isInfeasibleInstructionSuccessor(oldInstruction, _)
41+
or
42+
oldInstruction.getOpcode() instanceof Opcode::Unreached
43+
)
4044
)
4145
}
4246

@@ -366,21 +370,19 @@ private module Cached {
366370
then
367371
result = getChi(getOldInstruction(instruction)) and
368372
kind instanceof GotoEdge
369-
else (
373+
else
370374
exists(OldInstruction oldInstruction |
371-
oldInstruction = getOldInstruction(instruction) and
375+
(
376+
oldInstruction = getOldInstruction(instruction)
377+
or
378+
instruction = getChi(oldInstruction)
379+
) and
372380
(
373381
if Reachability::isInfeasibleInstructionSuccessor(oldInstruction, kind)
374382
then result = unreachedInstruction(instruction.getEnclosingIRFunction())
375383
else result = getNewInstruction(oldInstruction.getSuccessor(kind))
376384
)
377385
)
378-
or
379-
exists(OldInstruction oldInstruction |
380-
instruction = getChi(oldInstruction) and
381-
result = getNewInstruction(oldInstruction.getSuccessor(kind))
382-
)
383-
)
384386
}
385387

386388
cached

0 commit comments

Comments
 (0)