Skip to content

AstInterface

provides an abstract interface to access/modify AST nodes.

Synopsis

Declared in <src/midend/astUtil/astInterface/AstInterface.h>

class AstInterface;

Member Functions

Name

Description

AstInterface [constructor]

Construct from AstInterfaceImpl

~AstInterface [destructor]

Destructor

AddNewVarDecls

AttachObserver

BlockAppendStmt

BlockPrependStmt

CopyAstTree

CopyNewVarDecls

CreateAllocateArray

CreateAssignment

CreateBinaryOP

CreateBlock

CreateConstInt

CreateConstant

Create AST for constant values of types int, bool, string, float, etc. as well as names of variable and function references. e.g: CreateConstant("memberfunction","floatArray::length")

CreateDeleteArray

CreateFieldRef

CreateFunctionCall

CreateIf

Creates if‐else‐statement, or if‐statement (if __else_stmt is null).

CreateLoop

CreateMethodRef

CreateNullStatement

Creates an empty statement.

CreatePrintStatement

Creates a statement that prints __refs to stdout.

CreateReadStatement

Creates a statement that reads __refs from stdin.

CreateUnaryOP

CreateVarRef

CreateWriteStatement

Creates a statement that writes __refs to stdout.

DetachObserver

FreeAstTree

GetArrayBound

GetArrayType

GetBlockFirstStmt

GetBlockLastStmt

GetBlockSize

GetFunctionCallSideEffect

GetFunctionDefinition

GetNextStmt

GetParent

GetParentBlock

Returns the enclosing block.

GetParentStatement

Returns the enclosing statement.

GetPrevStmt

GetRoot

GetType

InsertAnnot

InsertStmt

IsAddressOfOp

IsAliasingDecl

Check if exp declares a set of variables to be aliased to non‐local storages, represented by the returned global_signatures.

IsBinaryOp

IsCompatibleType

IsConstInt

IsConstant

Check whether exp is a constant value of type int, float, string, etc.

IsDecls

IsExecutableStmt

IsFunctionCall

Returns true iff s is a function call, false otherwise. But also attempts to extract a bunch of info about the call.

IsFunctionType

IsGoto

Check whether s is a jump (goto, return, continue, break, etc) stmt; if yes, grab the jump destination in 'dest'

IsGotoAfter

IsGotoBefore

IsIOInputStmt

IsIOOutputStmt

IsLabelStatement

IsMax

IsMin

IsPointerType

IsPostTestLoop

IsScalarType

IsUnaryOp

IsVariableDecl

NewVar

RemoveStmt

ReplaceAst

SetParent

SetRoot

getNULL

get_fileInfo

get_impl

Static Member Functions

Name

Description

AstToString

AstTypeToString

Output the type of the AstNodePtr.

CreateArrayAccess

GetBaseType

GetBaseTypeName

GetBlockStmtList

GetChildrenList

GetExpressionType

GetFunctionDefinitionFromDeclaration

GetGlobalUniqueName

GetScopeName

GetTypeInfo

GetTypeName

GetVarName

GetVariableSignature

Returns a string that uniquely identifies the given variable.

IsArrayAccess

IsArrayType

IsAssignment

IsBlock

IsExprStmt

IsExpression

IsFortranLoop

Check whether s is a Fortran‐style loop in the form: for (ivar=lb;ivar<=ub;ivar+=step)

IsFunctionDefinition

IsIf

IsLocalRef

Returns whether the given ref reaches only local data within scope. if has_ptr_deref != 0, it is set to true if ref has pointer deref.

IsLoop

IsMemoryAccess

IsMemoryAllocation

IsMemoryFree

IsReturn

IsSameVarRef

IsStatement

IsVarRef

Check whether exp is a variable reference; If yes, return type, name, scope, and global/local etc.

SetFunctionNameMangling

SkipCasting

If there is a case, extract the operand and return it, otherwise return exp

getAstLocation

toString

unparseToString

Protected Data Members

Name

impl

Non-Member Functions

Name

Description

ReadAstTraverse

Traverse an entire AST, where op is invoked on each AST node to gather information.

TransformAstTraverse

Traverse and transform an entire AST, where op is invoked to transform each sub‐Tree.

Derived Classes

Name

Description

CPPAstInterface

Created with MrDocs