Skip to content

Commit 5a30ad1

Browse files
committed
C++: Add a comment for ReusedExpr IR translation
1 parent 3d4f7d8 commit 5a30ad1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2769,6 +2769,13 @@ class TranslatedTemporaryObjectExpr extends TranslatedNonConstantExpr,
27692769
final override Instruction getResult() { result = this.getTargetAddress() }
27702770
}
27712771

2772+
/**
2773+
* IR translation of a `ReuseExpr`.
2774+
*
2775+
* This translation produces a copy of the glvalue instruction holding the (unconverted) result
2776+
* of the reused expression. In the case where the original expression was a prvalue, the
2777+
* result will be a copy of the glvalue operand of a `TranslatedLoad`.
2778+
*/
27722779
class TranslatedReuseExpr extends TranslatedNonConstantExpr {
27732780
override ReuseExpr expr;
27742781

@@ -2797,7 +2804,7 @@ class TranslatedReuseExpr extends TranslatedNonConstantExpr {
27972804
result = this.getInstruction(OnlyInstructionTag())
27982805
}
27992806

2800-
override Instruction getInstructionRegisterOperand(InstructionTag tag, OperandTag operandTag) {
2807+
override Instruction getInstructionRegisterOperand(InstructionTag tag, OperandTag operandTag) {
28012808
tag = OnlyInstructionTag() and
28022809
operandTag instanceof UnaryOperandTag and
28032810
if getTranslatedExpr(expr.getReusedExpr()) instanceof TranslatedLoad

0 commit comments

Comments
 (0)