File tree Expand file tree Collapse file tree
cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -256,7 +256,17 @@ private predicate ignoreLoad(Expr expr) {
256256private predicate needsLoadForParentExpr ( Expr expr ) {
257257 exists ( CrementOperation crement | expr = crement .getOperand ( ) .getFullyConverted ( ) )
258258 or
259- exists ( AssignOperation ao | expr = ao .getLValue ( ) .getFullyConverted ( ) )
259+ exists ( AssignOperation ao | expr = ao .getLValue ( ) .getFullyConverted ( ) ) or
260+ // For arguments that are passed by value but require a constructor call, the extractor emits a
261+ // `TemporaryObjectExpr` as the argument, and marks it as a glvalue. This is roughly how a code-
262+ // generating compiler would implement this, passing the address of the temporary so that the
263+ // callee is using the exact same memory location allocated by the caller. We don't fully model
264+ // this yet, though, so we'll synthesize a load so that we appear to be passing the temporary
265+ // object via a bitwise copy.
266+ exists ( Call call |
267+ expr = call .getAnArgument ( ) .getFullyConverted ( ) .( TemporaryObjectExpr ) and
268+ expr .isGLValueCategory ( )
269+ )
260270}
261271
262272/**
You can’t perform that action at this time.
0 commit comments