C++: Add sanity check to Instruction.qll

This commit is contained in:
Mathias Vorreiter Pedersen
2020-02-20 22:09:02 +01:00
parent 76e5bd59df
commit 4545ad0f93

View File

@@ -268,6 +268,16 @@ module InstructionSanity {
}
}
query predicate switchInstructionWithoutDefaultEdge(
SwitchInstruction switchInstr, string message, IRFunction func, string funcText
) {
not exists(switchInstr.getDefaultSuccessor()) and
message =
"SwitchInstruction " + switchInstr.toString() + " without a DefaultEdge in function '$@'." and
func = switchInstr.getEnclosingIRFunction() and
funcText = Language::getIdentityString(func.getFunction())
}
/**
* Gets an `Instruction` that is contained in `IRFunction`, and has a location with the specified
* `File` and line number. Used for assigning register names when printing IR.