Skip to content

SageBuilder::buildVarRefExp

It is possible to build a reference to a variable with known name before thevariable is declared, especially during bottomup construction of AST. In thiscase, SgTypeUnknown is used to indicate the variable reference needingpostprocessing fix using fixVariableReferences() once the AST is complete andall variable declarations exist. But the side effect is that some get_type()operations may not recognize the unknown type before the fix. So far, I extendedSgPointerDerefExp::get_type() and SgPntrArrRefExp::get_type() for SgTypeUnknown.There may be others needing the same extension.

Synopsis

Declared in <SageIII/sageInterface/sageBuilder.h>

[[visibility]]
SgVarRefExp*
buildVarRefExp(
    SgName const& name,
    SgScopeStatement* scope = NULL);

Return Value

This class represents the variable refernece in expressions.

Parameters

Name

Description

name

This class represents strings within the IR nodes.

scope

This class represents the concept of a scope in C++ (e.g. global scope, fuction scope, etc.).

Created with MrDocs