Skip to content

SageInterface::mergeDeclarationAndAssignment

Merge a variable assignment statement into a matching variable declaration statement. Callers should make sure the merge is semantically correct (by not introducing compilation errors). This function simply does the merge transformation, without eligibility check.

Synopsis

Declared in <SageIII/sageInterface/sageInterface.h>

[[visibility]]
bool
mergeDeclarationAndAssignment(
    SgVariableDeclaration* decl,
    SgExprStatement* assign_stmt,
    bool removeAssignStmt = true);

Description

e.g. int i; i=10; becomes int i=10; the original i=10 will be deleted after the merge if success, return true, otherwise return false (e.g. variable declaration does not match or already has an initializer) The original assignment stmt will be removed by default This function is a bit ambiguous about the merge direction, to be phased out.

Parameters

Name

Description

decl

This class represents the concept of a C or C++ variable declaration.

assign_stmt

This class represents the concept of a C or C++ statement which contains a

Created with MrDocs