C++: Delete incorrect comment and add a bunch of barrier guard tests.

This commit is contained in:
Mathias Vorreiter Pedersen
2025-09-25 12:56:46 +01:00
parent 04ce4057e1
commit c1c1f60241
3 changed files with 59 additions and 23 deletions

View File

@@ -342,25 +342,7 @@ module GuardsInput implements SharedGuards::InputSig<Cpp::Location, Instruction,
/** Gets an expression returned from this function. */
GuardsInput::Expr getAReturnExpr() {
exists(StoreInstruction store |
// We use the `Store` instruction that writes the return value instead of the
// `ReturnValue` instruction since the `ReturnValue` instruction is not always
// dominated by certain guards. For example:
// ```
// if(b) {
// return true;
// } else {
// return false;
// }
// ```
// this will be translated into IR like:
// ```
// if(b) {
// x = true;
// } else {
// x = false;
// }
// return x;
// ```
// A write to the `IRVariable` which represents the return value.
store.getDestinationAddress().(VariableAddressInstruction).getIRVariable() instanceof
IRReturnVariable and
store.getEnclosingFunction() = this and