Skip to content

VariableRenaming::insertExpandedDefsForUse

Insert defs for member uses (chained names) that do not have an explicit def.

Synopsis

Declared in <src/midend/programAnalysis/variableRenaming/VariableRenaming.h>

bool
insertExpandedDefsForUse(
    cfgNode curNode,
    VarName name,
    NodeVec& changedNodes);

Description

When a member of a struct/class is used and that member does not have a propogated def on the current node, this will find the closest definition of a member in the ref chain and insert a definition for this use at that member's def.

ex. Obj o; //Declare o of type o o.a = 5; //Def for o.a int i = o.b.x; //Def for i, use for o.b.x int j = o.a.x; //Def for j, use for o.a.x

This function will insert the following: Obj o; //Declare o of type o, Def for o.a, def for o.b, def for o.b.x o.a = 5; //Def for o.a, use for o, use for o.a, def for o.a.x int i = o.b.x; //Def for i, use for o.b.x int j = o.a.x; //Def for j, use for o.a.x

Return Value

Whether any new defs were inserted.

Parameters

Name

Description

curNode

The node to expand the uses on.

name

The variableName to expand the uses for.

changedNodes

Vector of SgNode*

Created with MrDocs