Skip to content

ExtractFunctionArguments

This normalization makes sure each function call argument is a side‐effect free expression of only one variable. To accomplish this, temporary variables are declared and the arguments of a function are evaluated before the function itself. Note: Normalization is not performed if it is unsafe. E,g.: while(Foo(Bar()) {} is not equal to t = Bar(); while(Foo(t) {} Note that only SgFunctionCall arguments are normalized. For example the arguments of the constructor initializer MyObject o(foo(), bar()) will not be extracted.

Synopsis

Declared in <src/midend/programTransformation/extractFunctionArgumentsNormalization/ExtractFunctionArguments.h>

Member Functions

Name

Description

GetTemporariesIntroduced

IsNormalizable

IsNormalized

NormalizeTree

Performs the function argument extraction on all function calls in the given subtree of the AST.

Private Member Functions

Name

Description

AreAllFunctionCallsNormalizable

AreAllFunctionCallsTrivial

FunctionArgsNeedNormalization

Returns true if any of the arguments of the given function call will need to be extracted.

FunctionArgumentCanBeNormalized

FunctionArgumentNeedsNormalization

Given the expression which is the argument to a function call, returns true if that expression should be pulled out into a temporary variable on a separate line. E.g. if the expression contains a function call, it needs to be normalized, while if it is a constant, there is no need to change it.

InsertStatement

Insert a new statement in the specified location. The actual insertion can occur either before or after the location depending on the insertion mode.

IsFunctionArgumentTrivial

RewriteFunctionCallArguments

Given the information about a function call (obtained through a traversal), extract its arguments into temporary variables where it is necessary.

SubtreeNeedsNormalization

Returns true if any function calls in the given subtree will need to be instrumented. (to extract function arguments).

Private Data Members