Skip to content

SageBuilder::buildVariableDeclaration

All overloads of SageBuilder::buildVariableDeclaration

Build a fresh, structurally detached variable declaration in an exact semantic scope. A same-scope declaration with the same name is a hard error; use buildVariableRedeclaration() when the prior declaration is known. An explicit C/C++ written type must be distinct and semantically equivalent; it is attached before the declaration's variable symbol is published.

Synopsis

Declared in <SageIII/sageInterface/sageBuilder.h>

[[visibility("default")]]
SgVariableDeclaration*
buildVariableDeclaration(
    SgName const& name,
    SgType* type,
    SgInitializer* varInit,
    SgScopeStatement* scope,
    SgType* cxxSourceType = nullptr);

Return Value

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

Parameters

Name Description
name String-backed name value used by AST nodes.
type This class represents the base class for all types.
varInit This class represents the notion of an initializer for a variable declaration or
scope This class represents the concept of a scope in C++ (e.g. global scope, fuction scope, etc.).
cxxSourceType This class represents the base class for all types.

Created with MrDocs