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

Skip to content

Commit 4545ad0

Browse files
committed
C++: Add sanity check to Instruction.qll
1 parent 76e5bd5 commit 4545ad0

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,16 @@ module InstructionSanity {
268268
}
269269
}
270270

271+
query predicate switchInstructionWithoutDefaultEdge(
272+
SwitchInstruction switchInstr, string message, IRFunction func, string funcText
273+
) {
274+
not exists(switchInstr.getDefaultSuccessor()) and
275+
message =
276+
"SwitchInstruction " + switchInstr.toString() + " without a DefaultEdge in function '$@'." and
277+
func = switchInstr.getEnclosingIRFunction() and
278+
funcText = Language::getIdentityString(func.getFunction())
279+
}
280+
271281
/**
272282
* Gets an `Instruction` that is contained in `IRFunction`, and has a location with the specified
273283
* `File` and line number. Used for assigning register names when printing IR.

0 commit comments

Comments
 (0)