Skip to content

Commit b8bbce0

Browse files
author
Robert Marsh
committed
C#: sync IR
1 parent 30d7238 commit b8bbce0

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

csharp/ql/src/semmle/code/csharp/ir/implementation/raw/Instruction.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ module InstructionSanity {
120120
)
121121
}
122122

123+
query predicate sideEffectWithoutPrimary(SideEffectInstruction instr, string message, IRFunction func, string funcText) {
124+
not exists(instr.getPrimaryInstruction()) and
125+
message = "Side effect instruction missing primary instruction in function $@" and
126+
func = instr.getEnclosingIRFunction() and
127+
funcText = Language::getIdentityString(func.getFunction())
128+
}
129+
123130
/**
124131
* Holds if an instruction, other than `ExitFunction`, has no successors.
125132
*/

csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/Instruction.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ module InstructionSanity {
120120
)
121121
}
122122

123+
query predicate sideEffectWithoutPrimary(SideEffectInstruction instr, string message, IRFunction func, string funcText) {
124+
not exists(instr.getPrimaryInstruction()) and
125+
message = "Side effect instruction missing primary instruction in function $@" and
126+
func = instr.getEnclosingIRFunction() and
127+
funcText = Language::getIdentityString(func.getFunction())
128+
}
129+
123130
/**
124131
* Holds if an instruction, other than `ExitFunction`, has no successors.
125132
*/

csharp/ql/test/library-tests/ir/ir/raw_ir_sanity.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ unexpectedOperand
33
duplicateOperand
44
missingPhiOperand
55
missingOperandType
6+
sideEffectWithoutPrimary
67
instructionWithoutSuccessor
78
ambiguousSuccessors
89
unexplainedLoop

csharp/ql/test/library-tests/ir/ir/unaliased_ssa_sanity.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ unexpectedOperand
33
duplicateOperand
44
missingPhiOperand
55
missingOperandType
6+
sideEffectWithoutPrimary
67
instructionWithoutSuccessor
78
ambiguousSuccessors
89
unexplainedLoop

0 commit comments

Comments
 (0)