Skip to content

SageInterface::createTempVariableForExpression

Given an expression and an exact attached insertion anchor, atomically inserts a temporary variable immediately before the anchor and publishes its symbol. The returned variable‐reference expression can be used instead of the original expression. The optional SgAssignOp reevaluates the expression. Reference types are represented by pointer temporaries.

Synopsis

Declared in <SageIII/sageInterface/sageInterface.h>

std::pair<SgVariableDeclaration*, SgExpression*>
createTempVariableForExpression(
    SgExpression* expression,
    SgStatement* insertionAnchor,
    bool initializeInDeclaration,
    SgAssignOp** reEvaluate = NULL);

Return Value

attached declaration of the temporary variable and a variable reference expression to use instead of the original expression.

Parameters

Name

Description

expression

Expression which will be replaced by a variable

insertionAnchor

Attached direct child of the exact lexical scope that will own the temporary declaration

reEvaluate

an assignment op to reevaluate the expression. Leave NULL if not needed

Created with MrDocs