ROSE 0.11.145.192
Classes | Typedefs | Functions | Variables
SageInterface::Ada Namespace Reference

Description

Contains Ada-specific functionality.

Classes

struct  AggregateInfo
 
struct  DominantArgInfo
 
struct  FlatArrayType
 
struct  IfInfo
 represents a branch in an if elsif else context (either statement or expression). More...
 
struct  ImportedUnitResult
 
struct  OperatorScopeInfo
 
struct  PrimitiveParameterDesc
 
struct  PrimitiveSignatureElementsDesc
 
struct  RecordField
 
struct  ScopePath
 stores a path from an innermost scope to the global scope (not part of the path) in form of a sequence of Sage nodes that represent scopes (SgScopeStatements or SgDeclarationStatements). More...
 
struct  TypeDescription
 

Typedefs

using StatementRange = std::pair< SgDeclarationStatementPtrList::iterator, SgDeclarationStatementPtrList::iterator >
 
using FlatArrayTypeBase = std::tuple< SgArrayType *, SgExpressionPtrList, bool >
 defines the result type for getArrayTypeInfo
 
using RecordFieldBase = std::tuple< const SgSymbol * >
 
using IfExpressionInfo = IfInfo< SgExpression >
 returns a sequence of if (x) then value the last else does not have
 
using IfStatementInfo = IfInfo< SgStatement >
 
using TypeDescriptionBase = std::tuple< SgType *, bool, std::vector< SgAdaTypeConstraint * > >
 
using DominantArgInfoBase = std::tuple< const SgType *, std::size_t >
 
using OperatorScopeInfoBase = std::tuple< SgScopeStatement *, std::size_t >
 
using ImportedUnitResultBase = std::tuple< std::string, const SgDeclarationStatement *, const SgAdaRenamingDecl *, const SgExpression * >
 describes properties of imported units
 
using AggregateInfoBase = std::tuple< SgAdaAncestorInitializer *, SgExpressionPtrList::const_iterator, SgExpressionPtrList::const_iterator >
 Details of expression aggregates.
 
using PrimitiveParameterDescBase = std::tuple< size_t, const SgInitializedName *, const SgDeclarationStatement * >
 
using PrimitiveSignatureElementsDescBase = std::tuple< const SgDeclarationStatement *, std::vector< PrimitiveParameterDesc > >
 

Functions

SgInitializedNamedeclOf (const SgEnumVal &)
 returns the declaration of the enum value
 
SgTypestandardType (const std::string &name)
 returns a type from the standard package with name name.
 
std::vector< IfExpressionInfoflattenIfExpressions (const SgConditionalExp &n)
 returns a flat representation of if expressions
 
std::vector< IfStatementInfoflattenIfStatements (const SgIfStmt &n)
 returns a flat representation of if-elsif-else statements
 
long long int staticIntegralValue (SgExpression *n)
 integer constant folding
 
SgExpressionunderlyingExpr (const SgStatement *s)
 returns the expression of an expression statement, or nullptr if s is some other node
 
const SgScopeStatementcorrespondingBody (const SgScopeStatement *scope)
 returns the body scope (aka definition) of a task, package, or protected object.
 
DominantArgInfo operatorArgumentWithNamedRootIfAvail (const SgTypePtrList &argtypes)
 
OperatorScopeInfo operatorScope (const std::string &opname, const SgTypePtrList &argtypes)
 returns the scope where an operator with name opname and argument types in argtypes shall be declared.
 
std::vector< ImportedUnitResultimportedUnits (const SgImportStatement &impdcl)
 queries properties of all units in an import statement
 
SgScopeStatementpkgStandardScope ()
 do not use, this is temporary
 
std::string convertRoseOperatorNameToAdaName (const std::string &nameInRose)
 takes a function name as used in ROSE and converts it to a name in Ada (i.e., '"' + operator_text + '"').
 
std::string convertRoseOperatorNameToAdaOperator (const std::string &nameInRose)
 takes a function name as used in ROSE and converts it to an operator in Ada (i.e., operator_text).
 
SgExpressionPtrList normalizedCallArguments2 (const SgFunctionCallExp &n, const SgFunctionParameterList &arglist, bool withDefaultArguments=false)
 returns a list of arguments with named arguments placed at the correct position by taking into account the supplied argument list.
 
std::size_t normalizedArgumentPosition (const SgFunctionCallExp &call, const SgExpression &arg)
 returns the parameter position of arg in the callee, after the parameters have been normalized.
 
const SgScopeStatementcanonicalScope (const SgScopeStatement *scope)
 returns the canonical scope of some Ada scope scope.
 
const SgScopeStatementcanonicalScope (const SgScopeStatement &scope)
 
bool sameCanonicalScope (const SgScopeStatement *lhs, const SgScopeStatement *rhs)
 tests if lhs and have the same canonical scope.
 
SgDeclarationStatementassociatedDeclaration (const SgSymbol &n)
 returns the associated declaration for symbol n or nullptr if there is none.
 
bool explicitNullProcedure (const SgFunctionDefinition &fndef)
 returns true, iff fndef is the body of an explicit null procedure
 
bool explicitNullRecord (const SgClassDefinition &recdef)
 returns true, iff recdef is the body of an explicit null record
 
SgFunctionSymbolfindPubliclyVisibleFunction (SgFunctionSymbol &fnsym, const SgFunctionType &drvFunTy, const SgNamedType &dervTy)
 finds the function symbol for a publicly accessible function.
 
bool isAttribute (const SgAdaAttributeExp &attr, const std::string &attrname)
 tests if attr is an attribute with name attrname.
 
bool isAnyAccessAttribute (const SgAdaAttributeExp &attr)
 tests if attr is an access attribute
 
SgExprListExpisPragma (const SgPragmaDeclaration &prgdcl, const std::string &pragmaname)
 tests if prgdcl is a pragma with name pragmaname.
 
SgNodePtrList unparsedChildren (SgNode &n)
 returns a container of children nodes that are relevant for unparsing.
 
ScopePath pathToGlobal (const SgScopeStatement &n)
 Constructs a path from a scope statement to the top-level (global) scope.
 
bool withPrivateDefinition (const SgDeclarationStatement *dcl)
 tests if the declaration dcl defines a public type that is completed in a private section.
 
bool withPrivateDefinition (const SgDeclarationStatement &dcl)
 tests if the declaration dcl defines a public type that is completed in a private section.
 
bool unconstrained (const SgArrayType *ty)
 tests if ty is an unconstrained array
 
bool unconstrained (const SgArrayType &ty)
 tests if ty is an unconstrained array
 
bool anonymousAccess (const SgType *ty)
 tests if ty is an anonymous access type
 
bool anonymousAccess (const SgType &ty)
 tests if ty is an anonymous access type
 
StatementRange declsInPackage (SgGlobal &globalScope, const std::string &mainFile)
 returns all statements/declarations in the global scope that were defined in the source file.
 
StatementRange declsInPackage (SgGlobal &globalScope, const SgSourceFile &mainFile)
 returns all statements/declarations in the global scope that were defined in the source file.
 
int firstLastDimension (SgExprListExp &args)
 returns an integer value for args[0] as used by type attributes first and last
 
int firstLastDimension (SgExprListExp *args)
 returns an integer value for args[0] as used by type attributes first and last
 
FlatArrayType getArrayTypeInfo (SgType *atype)
 returns a flattened representation of Ada array types.
 
FlatArrayType getArrayTypeInfo (SgType &atype)
 returns a flattened representation of Ada array types.
 
std::vector< RecordFieldgetAllRecordFields (const SgClassDefinition &rec)
 returns all fields (defined and inherited) of a record.
 
std::vector< RecordFieldgetAllRecordFields (const SgClassDefinition *rec)
 returns all fields (defined and inherited) of a record.
 
SgRangeExprange (const SgAdaAttributeExp *rangeAttribute)
 returns a range for the range attribute rangeAttribute.
 
SgRangeExprange (const SgAdaAttributeExp &rangeAttribute)
 returns a range for the range attribute rangeAttribute.
 
bool denotesRange (const SgExpression &e)
 returns true if the expression e denotes a range
 
bool denotesRange (const SgExpression *e)
 returns true if the expression e denotes a range
 
SgAdaPackageSpecDeclgetSpecificationDeclaration (const SgAdaPackageBodyDecl &bodyDecl)
 returns the declaration node for the package specification
 
SgAdaPackageSpecDeclgetSpecificationDeclaration (const SgAdaPackageBodyDecl *bodyDecl)
 returns the declaration node for the package specification
 
SgAdaPackageBodyDeclgetPackageBodyDeclaration (const SgAdaPackageSpecDecl &specDecl)
 returns the declaration node for the package body, if available
 
SgAdaPackageBodyDeclgetPackageBodyDeclaration (const SgAdaPackageSpecDecl *specDecl)
 returns the declaration node for the package body, if available
 
SgAdaPackageSpecgetSpecificationDefinition (const SgAdaPackageBody &body)
 returns the specification definition (scope) of the package body
 
SgAdaPackageSpecgetSpecificationDefinition (const SgAdaPackageBody *body)
 returns the specification definition (scope) of the package body
 
SgAdaPackageBodygetBodyDefinition (const SgAdaPackageSpec &spec)
 returns the body definition (scope) of the package specification
 
SgAdaPackageBodygetBodyDefinition (const SgAdaPackageSpec *spec)
 returns the body definition (scope) of the package specification
 
SgDeclarationStatementgetSpecificationDeclaration (const SgAdaTaskBodyDecl &bodyDecl)
 returns the declaration node (either SgAdaTaskSpecDecl or SgAdaTaskTypeDecl) for the task specification
 
SgDeclarationStatementgetSpecificationDeclaration (const SgAdaTaskBodyDecl *bodyDecl)
 returns the declaration node (either SgAdaTaskSpecDecl or SgAdaTaskTypeDecl) for the task specification
 
SgDeclarationStatementgetSpecificationDeclaration (const SgAdaProtectedBodyDecl &bodyDecl)
 returns the declaration node (either SgAdaProtectedSpecDecl or SgAdaProtectedTypeDecl) for the protected object specification
 
SgDeclarationStatementgetSpecificationDeclaration (const SgAdaProtectedBodyDecl *bodyDecl)
 returns the declaration node (either SgAdaProtectedSpecDecl or SgAdaProtectedTypeDecl) for the protected object specification
 
SgStatementPtrList::iterator declarationLimit (SgStatementPtrList &list)
 returns the iterator to one past the last declaration (the limit) in the statement sequence.
 
SgStatementPtrList::iterator declarationLimit (SgBasicBlock &block)
 returns the iterator to one past the last declaration (the limit) in the statement sequence.
 
SgStatementPtrList::iterator declarationLimit (SgBasicBlock *block)
 returns the iterator to one past the last declaration (the limit) in the statement sequence.
 
SgStatementPtrList::const_iterator declarationLimit (const SgStatementPtrList &list)
 returns the iterator to one past the last declaration (the limit) in the statement sequence.
 
SgStatementPtrList::const_iterator declarationLimit (const SgBasicBlock &block)
 returns the iterator to one past the last declaration (the limit) in the statement sequence.
 
SgStatementPtrList::const_iterator declarationLimit (const SgBasicBlock *block)
 returns the iterator to one past the last declaration (the limit) in the statement sequence.
 
bool tryFollowsDeclarativeBlock (const SgTryStmt &n)
 returns true iff n is a try block following a declarative region
 
bool tryFollowsDeclarativeBlock (const SgTryStmt *n)
 returns true iff n is a try block following a declarative region
 
bool isPackageTryBlock (const SgTryStmt &n)
 returns true iff n is an Ada package try block
 
bool isPackageTryBlock (const SgTryStmt *n)
 returns true iff n is an Ada package try block
 
bool hasUnknownDiscriminants (const SgAdaDiscriminatedTypeDecl &n)
 returns true iff n has an unknown discriminant part
 
bool hasUnknownDiscriminants (const SgAdaDiscriminatedTypeDecl *n)
 returns true iff n has an unknown discriminant part
 
bool isOutInoutArgument (const SgFunctionCallExp &call, const SgExpression &arg)
 returns true if arg is a used as l-value in the call
 
bool isOutInoutArgument (const SgFunctionCallExp *call, const SgExpression *arg)
 returns true if arg is a used as l-value in the call
 
bool isModularType (const SgType &ty)
 return if the type ty is the corresponding universal type representation in ROSE
 
bool isModularType (const SgType *ty)
 return if the type ty is the corresponding universal type representation in ROSE
 
bool isIntegerType (const SgType &ty)
 return if the type ty is the corresponding universal type representation in ROSE
 
bool isIntegerType (const SgType *ty)
 return if the type ty is the corresponding universal type representation in ROSE
 
bool isFloatingPointType (const SgType &ty)
 return if the type ty is the corresponding universal type representation in ROSE
 
bool isFloatingPointType (const SgType *ty)
 return if the type ty is the corresponding universal type representation in ROSE
 
bool isDiscreteType (const SgType *ty)
 return if the type ty is the corresponding universal type representation in ROSE
 
bool isDiscreteType (const SgType &ty)
 return if the type ty is the corresponding universal type representation in ROSE
 
bool isBooleanType (const SgType *ty)
 return if the type ty is the corresponding universal type representation in ROSE
 
bool isBooleanType (const SgType &ty)
 return if the type ty is the corresponding universal type representation in ROSE
 
bool isFixedType (const SgType *ty)
 returns if the type ty is a fixed point type
 
bool isFixedType (const SgType &ty)
 returns if the type ty is a fixed point type
 
bool isScalarType (const SgType *ty)
 returns true if ty refers to a scalar type
 
bool isScalarType (const SgType &ty)
 returns true if ty refers to a scalar type
 
bool isDiscreteArrayType (const SgType &ty)
 returns true if ty refers to a discrete array type
 
bool isDiscreteArrayType (const SgType *ty)
 returns true if ty refers to a discrete array type
 
bool resolvesToFixedType (const SgType *ty)
 returns if the type ty resolves to a fixed point type
 
bool resolvesToFixedType (const SgType &ty)
 returns if the type ty resolves to a fixed point type
 
bool isDecimalFixedType (const SgType *ty)
 returns if the type ty is a decimal fixed point type
 
bool isDecimalFixedType (const SgType &ty)
 returns if the type ty is a decimal fixed point type
 
boost::optional< bool > booleanConstant (const SgExpression *e)
 if e denotes an Ada boolean constant, it is returned; otherwise an empty result is returned.
 
boost::optional< bool > booleanConstant (const SgExpression &e)
 if e denotes an Ada boolean constant, it is returned; otherwise an empty result is returned.
 
SgAdaGenericDeclisGenericDecl (const SgDeclarationStatement &n)
 Returns the SgAdaGenericDecl node that makes a declaration (either function/procedure or package) generic.
 
SgAdaGenericDeclisGenericDecl (const SgDeclarationStatement *n)
 Returns the SgAdaGenericDecl node that makes a declaration (either function/procedure or package) generic.
 
bool unitRefDenotesGenericInstance (const SgAdaUnitRefExp &n)
 returns true iff n refers to a generic declaration from inside said declaration false otherwise (e.g., if n does not refer to a generic unit)
 
bool unitRefDenotesGenericInstance (const SgAdaUnitRefExp *n)
 returns true iff n refers to a generic declaration from inside said declaration false otherwise (e.g., if n does not refer to a generic unit)
 
SgAdaGenericDeclgetGenericDecl (const SgAdaGenericInstanceDecl &n)
 Returns SgAdaGenericDecl for a given SgAdaGenericInstanceDecl.
 
SgAdaGenericDeclgetGenericDecl (const SgAdaGenericInstanceDecl *n)
 Returns SgAdaGenericDecl for a given SgAdaGenericInstanceDecl.
 
SgAdaDiscriminatedTypeDeclgetAdaDiscriminatedTypeDecl (const SgDeclarationStatement &n)
 returns the SgAdaDiscriminatedTypeDecl iff n is discriminated null otherwise
 
SgAdaDiscriminatedTypeDeclgetAdaDiscriminatedTypeDecl (const SgDeclarationStatement *n)
 returns the SgAdaDiscriminatedTypeDecl iff n is discriminated null otherwise
 
bool hasSeparatedBody (const SgDeclarationStatement &dcl)
 tests if the declaration decl corresponds to a stub (aka separated unit)
 
bool hasSeparatedBody (const SgDeclarationStatement *dcl)
 tests if the declaration decl corresponds to a stub (aka separated unit)
 
bool isSeparatedBody (const SgDeclarationStatement &n)
 returns true iff n is a unit definition that has been separated
 
bool isSeparatedBody (const SgDeclarationStatement *n)
 returns true iff n is a unit definition that has been separated
 
bool isSeparatedDefinition (const SgFunctionDeclaration &n)
 returns true iff n is a separated function definition is separated
 
bool isSeparatedDefinition (const SgFunctionDeclaration *n)
 returns true iff n is a separated function definition is separated
 
TypeDescription typeRoot (SgType &)
 returns the most fundamental type after skipping subtypes, typedefs, etc.
 
TypeDescription typeRoot (SgType *)
 returns the most fundamental type after skipping subtypes, typedefs, etc.
 
TypeDescription typeOfExpr (const SgExpression &)
 returns the type of an expression corrects for some peculiarities in the AST
 
TypeDescription typeOfExpr (const SgExpression *)
 returns the type of an expression corrects for some peculiarities in the AST
 
SgTypebaseOfAccessType (const SgType *ty)
 returns the base type if ty is an access type
 
SgTypebaseOfAccessType (const SgType &ty)
 returns the base type if ty is an access type
 
SgScopeStatementoperatorScope (const std::string &opname, const SgType &ty)
 returns the scope where an operator associated with type ty shall be declared.
 
SgScopeStatementoperatorScope (const std::string &opname, const SgType *ty)
 returns the scope where an operator associated with type ty shall be declared.
 
SgScopeStatementdeclarationScope (const SgType *ty)
 returns the scope where type ty has been declared
 
SgScopeStatementdeclarationScope (const SgType &ty)
 returns the scope where type ty has been declared
 
AggregateInfo splitAggregate (const SgExprListExp &exp)
 returns the ancestor initializer, if exp refers to an extension aggregate null otherwise
 
AggregateInfo splitAggregate (const SgExprListExp *exp)
 returns the ancestor initializer, if exp refers to an extension aggregate null otherwise
 
SgAdaPackageSpecDeclrenamedPackage (const SgAdaRenamingDecl &n)
 returns a package spec decl if the declaration n renames a package returns nullptr otherwise
 
SgAdaPackageSpecDeclrenamedPackage (const SgAdaRenamingDecl *n)
 returns a package spec decl if the declaration n renames a package returns nullptr otherwise
 
bool isFunction (const SgFunctionType &ty)
 returns true iff ty refers to a function type (as opposed to procedure)
 
bool isFunction (const SgFunctionType *ty)
 returns true iff ty refers to a function type (as opposed to procedure)
 
bool isFunction (const SgAdaSubroutineType &ty)
 returns true iff ty refers to a function type (as opposed to procedure)
 
bool isFunction (const SgAdaSubroutineType *ty)
 returns true iff ty refers to a function type (as opposed to procedure)
 
const SgFunctionTypefunctionType (const SgFunctionSymbol *fnsy)
 returns the static type of the function symbol fnsy
 
const SgFunctionTypefunctionType (const SgFunctionSymbol &fnsy)
 returns the static type of the function symbol fnsy
 
bool isObjectRenaming (const SgAdaRenamingDecl *dcl)
 returns true iff ty refers to an object renaming
 
bool isObjectRenaming (const SgAdaRenamingDecl &dcl)
 returns true iff ty refers to an object renaming
 
bool isExceptionRenaming (const SgAdaRenamingDecl *dcl)
 returns true iff ty refers to an exception renaming
 
bool isExceptionRenaming (const SgAdaRenamingDecl &dcl)
 returns true iff ty refers to an exception renaming
 
std::vector< PrimitiveParameterDescprimitiveParameterPositions (const SgFunctionDeclaration &fn)
 returns the descriptions for parameters that make an operation primitive.
 
std::vector< PrimitiveParameterDescprimitiveParameterPositions (const SgFunctionDeclaration *fn)
 returns the descriptions for parameters that make an operation primitive.
 
PrimitiveSignatureElementsDesc primitiveSignatureElements (const SgFunctionDeclaration &)
 returns the descriptions for result type and parameters that make an operation primitive.
 
PrimitiveSignatureElementsDesc primitiveSignatureElements (const SgFunctionDeclaration *)
 returns the descriptions for result type and parameters that make an operation primitive.
 
const SgVariableDeclarationexceptionTypeDecl (const SgVariableDeclaration &n)
 returns n or a pointer to n if n declares an exception type.
 
const SgVariableDeclarationexceptionTypeDecl (const SgVariableDeclaration *n)
 returns n or a pointer to n if n declares an exception type.
 
SgVariableDeclarationexceptionTypeDecl (SgVariableDeclaration &n)
 returns n or a pointer to n if n declares an exception type.
 
SgVariableDeclarationexceptionTypeDecl (SgVariableDeclaration *n)
 returns n or a pointer to n if n declares an exception type.
 
SgExpressionPtrList normalizedCallArguments (const SgFunctionCallExp &n, bool withDefaultArguments=false)
 attempts to identify the argument list automatically and uses it to invoke the preceding normalizedCallArguments2 function.
 
SgFunctionParameterListcalleeParameterList (const SgFunctionCallExp &n)
 returns the function parameter list of the associated callee (if available).
 
SgFunctionParameterListcalleeParameterList (const SgFunctionCallExp *n)
 returns the function parameter list of the associated callee (if available).
 
std::tuple< const SgScopeStatement *, const SgSymbol * > findSymbolInContext (std::string id, const SgScopeStatement &scope, const SgScopeStatement *limit=nullptr)
 finds the symbol with Naming tips in the context of scope or its logical parents in the range [scope, limit).
 
SgScopeStatementoverridingScope (const SgExprListExp &args, const std::vector< PrimitiveParameterDesc > &primitiveArgs)
 returns the overriding scope of a primitive function based on the associated arguments as defined by the argument list args and the primitive argument positions defined by primitiveArgs.
 
SgScopeStatementoverridingScope (const SgExprListExp *args, const std::vector< PrimitiveParameterDesc > &primitiveArgs)
 returns the overriding scope of a primitive function based on the associated arguments as defined by the argument list args and the primitive argument positions defined by primitiveArgs.
 
SgScopeStatementlogicalParentScope (const SgScopeStatement &s)
 returns the logical parent scope of a scope s.
 
SgScopeStatementlogicalParentScope (const SgScopeStatement *s)
 returns the logical parent scope of a scope s.
 
SgDeclarationStatementassociatedDeclaration (const SgType &ty)
 returns the decl where ty was defined nullptr if no such declaration can be found.
 
SgDeclarationStatementassociatedDeclaration (const SgType *ty)
 returns the decl where ty was defined nullptr if no such declaration can be found.
 
SgTypebaseType (const SgType &ty)
 returns the base type of a type ty
 
SgTypebaseType (const SgType *ty)
 returns the base type of a type ty
 
SgEnumDeclarationbaseEnumDeclaration (const SgType *ty)
 finds the underlying enum declaration of a type ty
 
SgEnumDeclarationbaseEnumDeclaration (const SgType &ty)
 finds the underlying enum declaration of a type ty
 
SgEnumTypecharacterBaseType (SgEnumType *ty)
 checks if the type is based on one of the Standard character types.
 
SgEnumTypecharacterBaseType (SgEnumType &ty)
 checks if the type is based on one of the Standard character types.
 
bool isReverseForLoop (const SgForStatement *n)
 returns true, iff n is a reverse for loop; returns false otherwise
 
bool isReverseForLoop (const SgForStatement &n)
 returns true, iff n is a reverse for loop; returns false otherwise
 
bool isReverseForLoop (const SgForInitStatement *n)
 returns true, iff n is a reverse for loop; returns false otherwise
 
bool isReverseForLoop (const SgForInitStatement &n)
 returns true, iff n is a reverse for loop; returns false otherwise
 
size_t positionalArgumentLimit (const SgExpressionPtrList &arglst)
 finds the one past the last positional argument (aka the first named argument position).
 
size_t positionalArgumentLimit (const SgExprListExp &args)
 finds the one past the last positional argument (aka the first named argument position).
 
size_t positionalArgumentLimit (const SgExprListExp *args)
 finds the one past the last positional argument (aka the first named argument position).
 
bool blockExistsInSource (const SgBasicBlock *blk)
 checks if the block blk is present in the Ada source code.
 
bool blockExistsInSource (const SgBasicBlock &blk)
 checks if the block blk is present in the Ada source code.
 
void simpleTraversal (std::function< void(SgNode *)> &&fn, SgNode *root)
 Traverses all AST nodes in an unspecified order.
 
void simpleTraversal (std::function< void(SgNode *)> &&fn, StatementRange roots)
 Traverses all AST nodes in an unspecified order.
 
void conversionTraversal (std::function< void(SgNode *)> &&fn, SgNode *root)
 
void conversionTraversal (std::function< void(SgNode *)> &&fn, StatementRange roots)
 
bool systemPackage (const SgScopeStatement &n)
 returns true if the scope n is part of a system package
 
bool systemPackage (const SgScopeStatement *n)
 returns true if the scope n is part of a system package
 
long long int convertIntegerLiteral (const char *img)
 converts text to constant values
 
std::string convertStringLiteral (const char *img)
 converts text to constant values
 
long double convertRealLiteral (const char *img)
 converts text to constant values
 
char convertCharLiteral (const char *img)
 converts text to constant values
 
void copyFileInfo (SgLocatedNode &tgt, const SgLocatedNode &src)
 copies the source code location from src to tgt.
 
void setSourcePositionInSubtreeToCompilerGenerated (SgLocatedNode *n)
 sets source position in entire subtree of n to compiler generated
 
void setSourcePositionInSubtreeToCompilerGenerated (SgLocatedNode &n)
 sets source position in entire subtree of n to compiler generated
 
void convertAdaToCxxComments (SgNode *root, bool cxxLineComments=true)
 /}
 
void convertToCaseSensitiveSymbolTables (SgNode *root)
 converts all symbol tables from case insensitive to case sensitive
 
void convertToOperatorRepresentation (SgNode *root, bool convertCallSyntax=false, bool convertNamedArguments=false)
 converts AST from a function call representation to operator form for fundamental operator declarations.
 

Variables

const std::string roseOperatorPrefix
 
const std::string packageStandardName
 
const std::string durationTypeName
 
const std::string exceptionName
 

Typedef Documentation

◆ StatementRange

using SageInterface::Ada::StatementRange = typedef std::pair<SgDeclarationStatementPtrList::iterator, SgDeclarationStatementPtrList::iterator>

Definition at line 198 of file sageInterfaceAda.h.

◆ FlatArrayTypeBase

using SageInterface::Ada::FlatArrayTypeBase = typedef std::tuple<SgArrayType*, SgExpressionPtrList, bool >

defines the result type for getArrayTypeInfo

Definition at line 226 of file sageInterfaceAda.h.

◆ RecordFieldBase

using SageInterface::Ada::RecordFieldBase = typedef std::tuple<const SgSymbol*>

Definition at line 260 of file sageInterfaceAda.h.

◆ IfExpressionInfo

returns a sequence of if (x) then value the last else does not have

Definition at line 302 of file sageInterfaceAda.h.

◆ IfStatementInfo

Definition at line 303 of file sageInterfaceAda.h.

◆ TypeDescriptionBase

using SageInterface::Ada::TypeDescriptionBase = typedef std::tuple<SgType*, bool, std::vector<SgAdaTypeConstraint*> >

Definition at line 557 of file sageInterfaceAda.h.

◆ DominantArgInfoBase

using SageInterface::Ada::DominantArgInfoBase = typedef std::tuple<const SgType*, std::size_t>

Definition at line 610 of file sageInterfaceAda.h.

◆ OperatorScopeInfoBase

using SageInterface::Ada::OperatorScopeInfoBase = typedef std::tuple<SgScopeStatement*, std::size_t>

Definition at line 624 of file sageInterfaceAda.h.

◆ ImportedUnitResultBase

using SageInterface::Ada::ImportedUnitResultBase = typedef std::tuple< std::string, const SgDeclarationStatement*, const SgAdaRenamingDecl*, const SgExpression* >

describes properties of imported units

Definition at line 673 of file sageInterfaceAda.h.

◆ AggregateInfoBase

using SageInterface::Ada::AggregateInfoBase = typedef std::tuple< SgAdaAncestorInitializer*, SgExpressionPtrList::const_iterator, SgExpressionPtrList::const_iterator >

Details of expression aggregates.

Definition at line 720 of file sageInterfaceAda.h.

◆ PrimitiveParameterDescBase

using SageInterface::Ada::PrimitiveParameterDescBase = typedef std::tuple<size_t, const SgInitializedName*, const SgDeclarationStatement*>

Definition at line 788 of file sageInterfaceAda.h.

◆ PrimitiveSignatureElementsDescBase

using SageInterface::Ada::PrimitiveSignatureElementsDescBase = typedef std::tuple< const SgDeclarationStatement* , std::vector<PrimitiveParameterDesc> >

Definition at line 833 of file sageInterfaceAda.h.

Function Documentation

◆ withPrivateDefinition() [1/2]

bool SageInterface::Ada::withPrivateDefinition ( const SgDeclarationStatement dcl)

tests if the declaration dcl defines a public type that is completed in a private section.

Returns
true, iff dcl is public and completed in a private section.
Precondition
dcl is not null and points to a first-nondefining declaration.

◆ withPrivateDefinition() [2/2]

bool SageInterface::Ada::withPrivateDefinition ( const SgDeclarationStatement dcl)

tests if the declaration dcl defines a public type that is completed in a private section.

Returns
true, iff dcl is public and completed in a private section.
Precondition
dcl is not null and points to a first-nondefining declaration.

◆ unconstrained() [1/2]

bool SageInterface::Ada::unconstrained ( const SgArrayType ty)

tests if ty is an unconstrained array

Returns
true iff ty is unconstrained

◆ unconstrained() [2/2]

bool SageInterface::Ada::unconstrained ( const SgArrayType ty)

tests if ty is an unconstrained array

Returns
true iff ty is unconstrained

◆ anonymousAccess() [1/2]

bool SageInterface::Ada::anonymousAccess ( const SgType ty)

tests if ty is an anonymous access type

Returns
true iff ty is an anonymous access type

◆ anonymousAccess() [2/2]

bool SageInterface::Ada::anonymousAccess ( const SgType ty)

tests if ty is an anonymous access type

Returns
true iff ty is an anonymous access type

◆ declsInPackage() [1/2]

StatementRange SageInterface::Ada::declsInPackage ( SgGlobal globalScope,
const std::string &  mainFile 
)

returns all statements/declarations in the global scope that were defined in the source file.

Parameters
globalScopea reference to the global scope
mainfilea reference to the main source file (name)
Returns
a range [first-in-sequence, limit-of-sequence) of global-scope level statements in mainFile

In other words, the declarations in the with'ed packages are excluded from the returned range.

◆ declsInPackage() [2/2]

StatementRange SageInterface::Ada::declsInPackage ( SgGlobal globalScope,
const SgSourceFile mainFile 
)

returns all statements/declarations in the global scope that were defined in the source file.

Parameters
globalScopea reference to the global scope
mainfilea reference to the main source file (name)
Returns
a range [first-in-sequence, limit-of-sequence) of global-scope level statements in mainFile

In other words, the declarations in the with'ed packages are excluded from the returned range.

◆ firstLastDimension() [1/2]

int SageInterface::Ada::firstLastDimension ( SgExprListExp args)

returns an integer value for args[0] as used by type attributes first and last

Exceptions
throwsan exception if args[0] cannot be constant folded
Note
currently only constant values are supported

◆ firstLastDimension() [2/2]

int SageInterface::Ada::firstLastDimension ( SgExprListExp args)

returns an integer value for args[0] as used by type attributes first and last

Exceptions
throwsan exception if args[0] cannot be constant folded
Note
currently only constant values are supported

◆ getArrayTypeInfo() [1/2]

FlatArrayType SageInterface::Ada::getArrayTypeInfo ( SgType atype)

returns a flattened representation of Ada array types.

Parameters
atypethe type of the array to be flattened.
Returns
iff atype is not an arraytype, a pair <nullptr, empty vector> is returned otherwise a pair of an array pointer, and a vector of index ranges. Index ranges can be specified in terms of a range (SgRangeExp), a type attribute (SgAdaAttributeExp), or full type range (SgTypeExpression). (the expressions are part of the AST and MUST NOT BE DELETED).

◆ getArrayTypeInfo() [2/2]

FlatArrayType SageInterface::Ada::getArrayTypeInfo ( SgType atype)

returns a flattened representation of Ada array types.

Parameters
atypethe type of the array to be flattened.
Returns
iff atype is not an arraytype, a pair <nullptr, empty vector> is returned otherwise a pair of an array pointer, and a vector of index ranges. Index ranges can be specified in terms of a range (SgRangeExp), a type attribute (SgAdaAttributeExp), or full type range (SgTypeExpression). (the expressions are part of the AST and MUST NOT BE DELETED).

◆ standardType()

SgType & SageInterface::Ada::standardType ( const std::string &  name)

returns a type from the standard package with name name.

Parameters
thename of a type in the standard package
Returns
a type representation
Precondition
name must be a type in package Standard, otherwise an exception is thrown

◆ getAllRecordFields() [1/2]

std::vector< RecordField > SageInterface::Ada::getAllRecordFields ( const SgClassDefinition rec)

returns all fields (defined and inherited) of a record.

Parameters
recthe class definition for which the fields are sought
Note
currently the entries in the returned vector are unordered.

◆ getAllRecordFields() [2/2]

std::vector< RecordField > SageInterface::Ada::getAllRecordFields ( const SgClassDefinition rec)

returns all fields (defined and inherited) of a record.

Parameters
recthe class definition for which the fields are sought
Note
currently the entries in the returned vector are unordered.

◆ staticIntegralValue()

long long int SageInterface::Ada::staticIntegralValue ( SgExpression n)

integer constant folding

Returns
an integral value for an Ada expression if possible
Exceptions
anexception otherwise.

◆ range() [1/2]

SgRangeExp * SageInterface::Ada::range ( const SgAdaAttributeExp rangeAttribute)

returns a range for the range attribute rangeAttribute.

Returns
a range if rangeAttribute is a range attribute and a range expression is in the AST; nullptr otherwise.
Exceptions
astd::runtime_error if the rangeAttribute uses an index specification that is not an integral constant expression.
Precondition
rangeAttribute is not null

◆ range() [2/2]

SgRangeExp * SageInterface::Ada::range ( const SgAdaAttributeExp rangeAttribute)

returns a range for the range attribute rangeAttribute.

Returns
a range if rangeAttribute is a range attribute and a range expression is in the AST; nullptr otherwise.
Exceptions
astd::runtime_error if the rangeAttribute uses an index specification that is not an integral constant expression.
Precondition
rangeAttribute is not null

◆ correspondingBody()

const SgScopeStatement * SageInterface::Ada::correspondingBody ( const SgScopeStatement scope)

returns the body scope (aka definition) of a task, package, or protected object.

Parameters
scopea task, package, protected object spec or body
Returns
the corresponding body scope (i.e., SgAdaProtectedBody, SgAdaPackageBody, SgAdaTaskBody) returns null when a body cannot be found

given a spec or body, the function returns the body, null otherwise e.g., getBodyScope(SgAdaPackageSpec) -> SgAdaPackageBody getBodyScope(SgAdaPackageBody) -> SgAdaPackageBody getBodyScope(SgFunctionDefinition) -> nullptr

◆ tryFollowsDeclarativeBlock() [1/2]

bool SageInterface::Ada::tryFollowsDeclarativeBlock ( const SgTryStmt n)

returns true iff n is a try block following a declarative region

Note
an ada try block is a function block, whose non-declarative range includes exactly one try stmt. In this case, the unparser can omit the separate begin and end statement.

◆ tryFollowsDeclarativeBlock() [2/2]

bool SageInterface::Ada::tryFollowsDeclarativeBlock ( const SgTryStmt n)

returns true iff n is a try block following a declarative region

Note
an ada try block is a function block, whose non-declarative range includes exactly one try stmt. In this case, the unparser can omit the separate begin and end statement.

◆ isPackageTryBlock() [1/2]

bool SageInterface::Ada::isPackageTryBlock ( const SgTryStmt n)

returns true iff n is an Ada package try block

Note
an ada try block is a function block, whose non-declarative range includes exactly one try stmt. In this case, the unparser can omit the separate begin and end statement.

◆ isPackageTryBlock() [2/2]

bool SageInterface::Ada::isPackageTryBlock ( const SgTryStmt n)

returns true iff n is an Ada package try block

Note
an ada try block is a function block, whose non-declarative range includes exactly one try stmt. In this case, the unparser can omit the separate begin and end statement.

◆ isFixedType() [1/2]

bool SageInterface::Ada::isFixedType ( const SgType ty)

returns if the type ty is a fixed point type

also return true for decimal fixed points

◆ isFixedType() [2/2]

bool SageInterface::Ada::isFixedType ( const SgType ty)

returns if the type ty is a fixed point type

also return true for decimal fixed points

◆ isScalarType() [1/2]

bool SageInterface::Ada::isScalarType ( const SgType ty)

returns true if ty refers to a scalar type

true if the ty's root type is a modular type, signed integer type, enumeration type, discrete type, fixed type, decimal fixed type, or enum type.

◆ isScalarType() [2/2]

bool SageInterface::Ada::isScalarType ( const SgType ty)

returns true if ty refers to a scalar type

true if the ty's root type is a modular type, signed integer type, enumeration type, discrete type, fixed type, decimal fixed type, or enum type.

◆ resolvesToFixedType() [1/2]

bool SageInterface::Ada::resolvesToFixedType ( const SgType ty)

returns if the type ty resolves to a fixed point type

also return true for decimal fixed points

◆ resolvesToFixedType() [2/2]

bool SageInterface::Ada::resolvesToFixedType ( const SgType ty)

returns if the type ty resolves to a fixed point type

also return true for decimal fixed points

◆ isDecimalFixedType() [1/2]

bool SageInterface::Ada::isDecimalFixedType ( const SgType ty)

returns if the type ty is a decimal fixed point type

implementation is incomplete and only detects formal decimal fixed point constraints

◆ isDecimalFixedType() [2/2]

bool SageInterface::Ada::isDecimalFixedType ( const SgType ty)

returns if the type ty is a decimal fixed point type

implementation is incomplete and only detects formal decimal fixed point constraints

◆ booleanConstant() [1/2]

boost::optional< bool > SageInterface::Ada::booleanConstant ( const SgExpression e)

if e denotes an Ada boolean constant, it is returned; otherwise an empty result is returned.

the function does not perform any constant folding

◆ booleanConstant() [2/2]

boost::optional< bool > SageInterface::Ada::booleanConstant ( const SgExpression e)

if e denotes an Ada boolean constant, it is returned; otherwise an empty result is returned.

the function does not perform any constant folding

◆ isGenericDecl() [1/2]

SgAdaGenericDecl * SageInterface::Ada::isGenericDecl ( const SgDeclarationStatement n)

Returns the SgAdaGenericDecl node that makes a declaration (either function/procedure or package) generic.

Parameters
na declaration that is possibly part of a generic declaration.
Returns
the generic declaration of n, where n is a either function/procedure or package that is declared directly under an SgAdaGenericDecl; nullptr otherwise.

For a subtree SgAdaGenericDecl->SgAdaGenericDefn->n, the SgAdaGenericDecl node is returned.

◆ isGenericDecl() [2/2]

SgAdaGenericDecl * SageInterface::Ada::isGenericDecl ( const SgDeclarationStatement n)

Returns the SgAdaGenericDecl node that makes a declaration (either function/procedure or package) generic.

Parameters
na declaration that is possibly part of a generic declaration.
Returns
the generic declaration of n, where n is a either function/procedure or package that is declared directly under an SgAdaGenericDecl; nullptr otherwise.

For a subtree SgAdaGenericDecl->SgAdaGenericDefn->n, the SgAdaGenericDecl node is returned.

◆ getGenericDecl() [1/2]

SgAdaGenericDecl & SageInterface::Ada::getGenericDecl ( const SgAdaGenericInstanceDecl n)

Returns SgAdaGenericDecl for a given SgAdaGenericInstanceDecl.

skips over intermediate renaming declarations.

◆ getGenericDecl() [2/2]

SgAdaGenericDecl * SageInterface::Ada::getGenericDecl ( const SgAdaGenericInstanceDecl n)

Returns SgAdaGenericDecl for a given SgAdaGenericInstanceDecl.

skips over intermediate renaming declarations.

◆ typeOfExpr() [1/2]

TypeDescription SageInterface::Ada::typeOfExpr ( const SgExpression )

returns the type of an expression corrects for some peculiarities in the AST

◆ typeOfExpr() [2/2]

TypeDescription SageInterface::Ada::typeOfExpr ( const SgExpression )

returns the type of an expression corrects for some peculiarities in the AST

◆ baseOfAccessType() [1/2]

SgType * SageInterface::Ada::baseOfAccessType ( const SgType ty)

returns the base type if ty is an access type

Parameters
tysome type
Returns
the base type of ty, iff ty is some access type nullptr otherwise;

◆ baseOfAccessType() [2/2]

SgType * SageInterface::Ada::baseOfAccessType ( const SgType ty)

returns the base type if ty is an access type

Parameters
tysome type
Returns
the base type of ty, iff ty is some access type nullptr otherwise;

◆ operatorScope() [1/3]

OperatorScopeInfo SageInterface::Ada::operatorScope ( const std::string &  opname,
const SgTypePtrList &  argtypes 
)

returns the scope where an operator with name opname and argument types in argtypes shall be declared.

Parameters
opnamethe operator name
argtypesa list of argument types
Returns
a scope where the described operator shall be declared, and the argument position associated with the scope.

◆ operatorScope() [2/3]

SgScopeStatement & SageInterface::Ada::operatorScope ( const std::string &  opname,
const SgType ty 
)

returns the scope where an operator associated with type ty shall be declared.

Parameters
opnamethe operator name
tythe type name
Returns
a scope where the described operator shall be declared.
Note
the main difference to declarationScope is that fixed types require certain operators to exist in package standard.

◆ operatorScope() [3/3]

SgScopeStatement * SageInterface::Ada::operatorScope ( const std::string &  opname,
const SgType ty 
)

returns the scope where an operator associated with type ty shall be declared.

Parameters
opnamethe operator name
tythe type name
Returns
a scope where the described operator shall be declared.
Note
the main difference to declarationScope is that fixed types require certain operators to exist in package standard.

◆ declarationScope() [1/2]

SgScopeStatement * SageInterface::Ada::declarationScope ( const SgType ty)

returns the scope where type ty has been declared

Parameters
tysome type
Returns
the scope where ty was declared

◆ declarationScope() [2/2]

SgScopeStatement * SageInterface::Ada::declarationScope ( const SgType ty)

returns the scope where type ty has been declared

Parameters
tysome type
Returns
the scope where ty was declared

◆ convertRoseOperatorNameToAdaName()

std::string SageInterface::Ada::convertRoseOperatorNameToAdaName ( const std::string &  nameInRose)

takes a function name as used in ROSE and converts it to a name in Ada (i.e., '"' + operator_text + '"').

if nameInRose does not name an operator, then the name is returned as is.

◆ convertRoseOperatorNameToAdaOperator()

std::string SageInterface::Ada::convertRoseOperatorNameToAdaOperator ( const std::string &  nameInRose)

takes a function name as used in ROSE and converts it to an operator in Ada (i.e., operator_text).

if nameInRose does not name an operator, an empty string is returned

◆ functionType() [1/2]

const SgFunctionType * SageInterface::Ada::functionType ( const SgFunctionSymbol fnsy)

returns the static type of the function symbol fnsy

Note
The pointer based version returns nullptr if fnsy is nullptr.

◆ functionType() [2/2]

const SgFunctionType & SageInterface::Ada::functionType ( const SgFunctionSymbol fnsy)

returns the static type of the function symbol fnsy

Note
The pointer based version returns nullptr if fnsy is nullptr.

◆ primitiveParameterPositions() [1/2]

std::vector< PrimitiveParameterDesc > SageInterface::Ada::primitiveParameterPositions ( const SgFunctionDeclaration fn)

returns the descriptions for parameters that make an operation primitive.

(e.g., derived types, tagged types, and anonymous access types of those.)

Note
Different sources have (slightly) different definitions of primitive subprograms and primitive arguments. This implementation uses the definition by learn.adacore.com: "A primitive operation (or just a primitive) is a subprogram attached to a type. Ada defines primitives as subprograms defined in the same scope as the type." https://learn.adacore.com/courses/intro-to-ada/chapters/object_oriented_programming.html Thus, primitive parameters can also be of derived type.

Other sources tie the notion of primitive arguments to tagged types. e.g., https://en.wikibooks.org/wiki/Ada_Programming/Object_Orientation#Primitive_operations . accessed on 04/01/26.

◆ primitiveParameterPositions() [2/2]

std::vector< PrimitiveParameterDesc > SageInterface::Ada::primitiveParameterPositions ( const SgFunctionDeclaration fn)

returns the descriptions for parameters that make an operation primitive.

(e.g., derived types, tagged types, and anonymous access types of those.)

Note
Different sources have (slightly) different definitions of primitive subprograms and primitive arguments. This implementation uses the definition by learn.adacore.com: "A primitive operation (or just a primitive) is a subprogram attached to a type. Ada defines primitives as subprograms defined in the same scope as the type." https://learn.adacore.com/courses/intro-to-ada/chapters/object_oriented_programming.html Thus, primitive parameters can also be of derived type.

Other sources tie the notion of primitive arguments to tagged types. e.g., https://en.wikibooks.org/wiki/Ada_Programming/Object_Orientation#Primitive_operations . accessed on 04/01/26.

◆ primitiveSignatureElements() [1/2]

PrimitiveSignatureElementsDesc SageInterface::Ada::primitiveSignatureElements ( const SgFunctionDeclaration )

returns the descriptions for result type and parameters that make an operation primitive.

(e.g., derived types, tagged types, and anonymous access types of those.)

◆ primitiveSignatureElements() [2/2]

PrimitiveSignatureElementsDesc SageInterface::Ada::primitiveSignatureElements ( const SgFunctionDeclaration )

returns the descriptions for result type and parameters that make an operation primitive.

(e.g., derived types, tagged types, and anonymous access types of those.)

◆ exceptionTypeDecl() [1/4]

const SgVariableDeclaration * SageInterface::Ada::exceptionTypeDecl ( const SgVariableDeclaration n)

returns n or a pointer to n if n declares an exception type.

Parameters
nan exception declaration candidate
Returns
a pointer to a exception declaration or nullptr

◆ exceptionTypeDecl() [2/4]

const SgVariableDeclaration * SageInterface::Ada::exceptionTypeDecl ( const SgVariableDeclaration n)

returns n or a pointer to n if n declares an exception type.

Parameters
nan exception declaration candidate
Returns
a pointer to a exception declaration or nullptr

◆ exceptionTypeDecl() [3/4]

SgVariableDeclaration * SageInterface::Ada::exceptionTypeDecl ( SgVariableDeclaration n)

returns n or a pointer to n if n declares an exception type.

Parameters
nan exception declaration candidate
Returns
a pointer to a exception declaration or nullptr

◆ exceptionTypeDecl() [4/4]

SgVariableDeclaration * SageInterface::Ada::exceptionTypeDecl ( SgVariableDeclaration n)

returns n or a pointer to n if n declares an exception type.

Parameters
nan exception declaration candidate
Returns
a pointer to a exception declaration or nullptr

◆ normalizedCallArguments2()

SgExpressionPtrList SageInterface::Ada::normalizedCallArguments2 ( const SgFunctionCallExp n,
const SgFunctionParameterList arglist,
bool  withDefaultArguments = false 
)

returns a list of arguments with named arguments placed at the correct position by taking into account the supplied argument list.

Parameters
nthe call expression
arglista argument list
withDefaultArgumentstrue if defaulted arguments should get filled in. if false, defaulted arguments are represented by a nullptr
Exceptions
std::logic_errorwhen named arguments cannot be identified.
Note
  • use this function during AST construction

◆ normalizedCallArguments()

SgExpressionPtrList SageInterface::Ada::normalizedCallArguments ( const SgFunctionCallExp n,
bool  withDefaultArguments = false 
)

attempts to identify the argument list automatically and uses it to invoke the preceding normalizedCallArguments2 function.

Parameters
nthe call expression
withDefaultArgumentstrue if defaulted arguments should get filled in. if false, defaulted arguments are represented by a nullptr
Exceptions
std::logic_errorwhen there is no function associated with the call. or when normalizedCallArguments2 throws.
Note
calling this function is preferred in the general case.

◆ calleeParameterList() [1/2]

SgFunctionParameterList * SageInterface::Ada::calleeParameterList ( const SgFunctionCallExp n)

returns the function parameter list of the associated callee (if available).

Parameters
na function call expression
Returns
the list of the parameter list of the associated function declaration or renaming declaration. nullptr, if no such function can be identified.

◆ calleeParameterList() [2/2]

SgFunctionParameterList * SageInterface::Ada::calleeParameterList ( const SgFunctionCallExp n)

returns the function parameter list of the associated callee (if available).

Parameters
na function call expression
Returns
the list of the parameter list of the associated function declaration or renaming declaration. nullptr, if no such function can be identified.

◆ normalizedArgumentPosition()

std::size_t SageInterface::Ada::normalizedArgumentPosition ( const SgFunctionCallExp call,
const SgExpression arg 
)

returns the parameter position of arg in the callee, after the parameters have been normalized.

Exceptions
astd::logic_error when a position cannot be found.

assume declaration: procedure X(left, right : integer := 1); and call: X(right => 3) then normalizedArgumentPosition(call, "3") -> 1

◆ findSymbolInContext()

std::tuple< const SgScopeStatement *, const SgSymbol * > SageInterface::Ada::findSymbolInContext ( std::string  id,
const SgScopeStatement scope,
const SgScopeStatement limit = nullptr 
)

finds the symbol with Naming tips in the context of scope or its logical parents in the range [scope, limit).

Parameters
namean identifier of the sought symbol
scopecurrent scope
limitthe scope in the chain that terminates the search (this scope will not be considered)
Returns
a tuple of scope and first symbol inthat scope with the name Naming tips. or <nullptr, nullptr> if no such symbol exists in the context.

a scope can contain multiple symbols with the same name, so the caller may iterate over the remaining names using the scope's accessor functions (next_XXX_symbol).

◆ overridingScope() [1/2]

SgScopeStatement * SageInterface::Ada::overridingScope ( const SgExprListExp args,
const std::vector< PrimitiveParameterDesc > &  primitiveArgs 
)

returns the overriding scope of a primitive function based on the associated arguments as defined by the argument list args and the primitive argument positions defined by primitiveArgs.

Returns
the scope of an overriding argument (incl. the original associated type); nullptr if no such scope can be found.
Note
does not resolve conflicting scopes
See also
also primitiveParameterPositions

◆ overridingScope() [2/2]

SgScopeStatement * SageInterface::Ada::overridingScope ( const SgExprListExp args,
const std::vector< PrimitiveParameterDesc > &  primitiveArgs 
)

returns the overriding scope of a primitive function based on the associated arguments as defined by the argument list args and the primitive argument positions defined by primitiveArgs.

Returns
the scope of an overriding argument (incl. the original associated type); nullptr if no such scope can be found.
Note
does not resolve conflicting scopes
See also
also primitiveParameterPositions

◆ canonicalScope()

const SgScopeStatement * SageInterface::Ada::canonicalScope ( const SgScopeStatement scope)

returns the canonical scope of some Ada scope scope.

The canonical scope of an entity is its declarative scope e.g., The canonical scope of an SgAdaPackageBody is its spec, a SgAdaPackageSpec

◆ logicalParentScope() [1/2]

SgScopeStatement * SageInterface::Ada::logicalParentScope ( const SgScopeStatement s)

returns the logical parent scope of a scope s.

Compared to si::getEnclosingScope, this function returns the spec as the logical parent for Ada bodies (e.g., packages, tasks, protected objects). Otherwise, the parent scope is the same as returned by si::getEnclosingScope.

◆ logicalParentScope() [2/2]

SgScopeStatement * SageInterface::Ada::logicalParentScope ( const SgScopeStatement s)

returns the logical parent scope of a scope s.

Compared to si::getEnclosingScope, this function returns the spec as the logical parent for Ada bodies (e.g., packages, tasks, protected objects). Otherwise, the parent scope is the same as returned by si::getEnclosingScope.

◆ associatedDeclaration() [1/2]

SgDeclarationStatement * SageInterface::Ada::associatedDeclaration ( const SgType ty)

returns the decl where ty was defined nullptr if no such declaration can be found.

Skips over intermediate derived types, subtypes, access (pointer) types until a SgNamedType is found. Returns the declaration of said type.

◆ associatedDeclaration() [2/2]

SgDeclarationStatement * SageInterface::Ada::associatedDeclaration ( const SgType ty)

returns the decl where ty was defined nullptr if no such declaration can be found.

Skips over intermediate derived types, subtypes, access (pointer) types until a SgNamedType is found. Returns the declaration of said type.

◆ baseType() [1/2]

SgType * SageInterface::Ada::baseType ( const SgType ty)

returns the base type of a type ty

In the following type hierarchy baseType(Y) -> S1 -> X but not Integer.

type X is new Integer;
subtype S1 is X range 0..X'Last;
subtype S2 is S1 range 10..20;
type Y is new S1;
SgRangeExp * range(const SgAdaAttributeExp *rangeAttribute)
returns a range for the range attribute rangeAttribute.

◆ baseType() [2/2]

SgType * SageInterface::Ada::baseType ( const SgType ty)

returns the base type of a type ty

In the following type hierarchy baseType(Y) -> S1 -> X but not Integer.

type X is new Integer;
subtype S1 is X range 0..X'Last;
subtype S2 is S1 range 10..20;
type Y is new S1;

◆ baseEnumDeclaration() [1/2]

SgEnumDeclaration * SageInterface::Ada::baseEnumDeclaration ( const SgType ty)

finds the underlying enum declaration of a type ty

Returns
an enum declaration associated with ty nullptr if no declaration can be found

baseEnumDeclaration skips over intermediate SgTypedefDeclarations that introduce a new type (

◆ baseEnumDeclaration() [2/2]

SgEnumDeclaration * SageInterface::Ada::baseEnumDeclaration ( const SgType ty)

finds the underlying enum declaration of a type ty

Returns
an enum declaration associated with ty nullptr if no declaration can be found

baseEnumDeclaration skips over intermediate SgTypedefDeclarations that introduce a new type (

◆ characterBaseType() [1/2]

SgEnumType * SageInterface::Ada::characterBaseType ( SgEnumType ty)

checks if the type is based on one of the Standard character types.

Returns
the base enum type (Character, Wide_Character, or Wide_Wide_Character), if the input type is based of one of them. otherwise, returns nullptr
Note
In ROSE, character based enums currently do not have any member. Thus, some analysis may handle character based enums differently.

◆ characterBaseType() [2/2]

SgEnumType * SageInterface::Ada::characterBaseType ( SgEnumType ty)

checks if the type is based on one of the Standard character types.

Returns
the base enum type (Character, Wide_Character, or Wide_Wide_Character), if the input type is based of one of them. otherwise, returns nullptr
Note
In ROSE, character based enums currently do not have any member. Thus, some analysis may handle character based enums differently.

◆ positionalArgumentLimit() [1/3]

size_t SageInterface::Ada::positionalArgumentLimit ( const SgExpressionPtrList &  arglst)

finds the one past the last positional argument (aka the first named argument position).

Returns
one past the index of the last positional argument.

examples:

  • argument lists without positional arguments => 0
  • argument lists without named arguments => args.size()
  • empty argument lists => 0
  • (1, 2, LEN => 3) => 2

◆ positionalArgumentLimit() [2/3]

size_t SageInterface::Ada::positionalArgumentLimit ( const SgExprListExp args)

finds the one past the last positional argument (aka the first named argument position).

Returns
one past the index of the last positional argument.

examples:

  • argument lists without positional arguments => 0
  • argument lists without named arguments => args.size()
  • empty argument lists => 0
  • (1, 2, LEN => 3) => 2

◆ positionalArgumentLimit() [3/3]

size_t SageInterface::Ada::positionalArgumentLimit ( const SgExprListExp args)

finds the one past the last positional argument (aka the first named argument position).

Returns
one past the index of the last positional argument.

examples:

  • argument lists without positional arguments => 0
  • argument lists without named arguments => args.size()
  • empty argument lists => 0
  • (1, 2, LEN => 3) => 2

◆ blockExistsInSource() [1/2]

bool SageInterface::Ada::blockExistsInSource ( const SgBasicBlock blk)

checks if the block blk is present in the Ada source code.

Parameters
blka reference or pointer to a ROSE basic block object.
Returns
true of the block is in the source code. false if the block is ROSE artifact (or nullptr).

◆ blockExistsInSource() [2/2]

bool SageInterface::Ada::blockExistsInSource ( const SgBasicBlock blk)

checks if the block blk is present in the Ada source code.

Parameters
blka reference or pointer to a ROSE basic block object.
Returns
true of the block is in the source code. false if the block is ROSE artifact (or nullptr).

◆ findPubliclyVisibleFunction()

SgFunctionSymbol * SageInterface::Ada::findPubliclyVisibleFunction ( SgFunctionSymbol fnsym,
const SgFunctionType drvFunTy,
const SgNamedType dervTy 
)

finds the function symbol for a publicly accessible function.

Parameters
fnsymthe function symbol (maybe be private)
drvFunTythe derived function type
dervTythe derived type for which the symbol is sought
Returns
a function that is publicly accessible and can be used for default argument resolution. if none is found a pointer to fnsym is returned..

◆ isAnyAccessAttribute()

bool SageInterface::Ada::isAnyAccessAttribute ( const SgAdaAttributeExp attr)

tests if attr is an access attribute

either 'access, 'unchecked_access, or 'unrestricted_access.

◆ isPragma()

SgExprListExp * SageInterface::Ada::isPragma ( const SgPragmaDeclaration prgdcl,
const std::string &  pragmaname 
)

tests if prgdcl is a pragma with name pragmaname.

Parameters
prgdclthe pragma declaration
pragmanamethe name to test for
thepragmas argument list (possibly empty) if prgdcl is a pragmaname pragma; nullptr otherwise.

◆ simpleTraversal() [1/2]

void SageInterface::Ada::simpleTraversal ( std::function< void(SgNode *)> &&  fn,
SgNode root 
)

Traverses all AST nodes in an unspecified order.

Only traverses edges that are commonly traversed by ROSE's standard traversal mechanism.

Parameters
fna functor that queries and possibly transforms the AST
roota singular root node (all subtrees are traversed)
rootsa statement range of root nodes.
Note
fn is typically a functor that collects all nodes that need to be converted in a first pass. An update pass, triggered by fn's destructor carries out the actual transformations of the collected nodes.

◆ simpleTraversal() [2/2]

void SageInterface::Ada::simpleTraversal ( std::function< void(SgNode *)> &&  fn,
StatementRange  roots 
)

Traverses all AST nodes in an unspecified order.

Only traverses edges that are commonly traversed by ROSE's standard traversal mechanism.

Parameters
fna functor that queries and possibly transforms the AST
roota singular root node (all subtrees are traversed)
rootsa statement range of root nodes.
Note
fn is typically a functor that collects all nodes that need to be converted in a first pass. An update pass, triggered by fn's destructor carries out the actual transformations of the collected nodes.

◆ conversionTraversal() [1/2]

void SageInterface::Ada::conversionTraversal ( std::function< void(SgNode *)> &&  fn,
SgNode root 
)

◆ conversionTraversal() [2/2]

void SageInterface::Ada::conversionTraversal ( std::function< void(SgNode *)> &&  fn,
StatementRange  roots 
)

◆ pathToGlobal()

ScopePath SageInterface::Ada::pathToGlobal ( const SgScopeStatement n)

Constructs a path from a scope statement to the top-level (global) scope.

The path contains [n, global)

Parameters
ninnermost scope

◆ setSourcePositionInSubtreeToCompilerGenerated() [1/2]

void SageInterface::Ada::setSourcePositionInSubtreeToCompilerGenerated ( SgLocatedNode n)

sets source position in entire subtree of n to compiler generated

Note
compare with SageInterface::setSourcePositionAtRootAndAllChildren the SageInterface does not implement setting the source position to compiler generated.

◆ setSourcePositionInSubtreeToCompilerGenerated() [2/2]

void SageInterface::Ada::setSourcePositionInSubtreeToCompilerGenerated ( SgLocatedNode n)

sets source position in entire subtree of n to compiler generated

Note
compare with SageInterface::setSourcePositionAtRootAndAllChildren the SageInterface does not implement setting the source position to compiler generated.

◆ convertAdaToCxxComments()

void SageInterface::Ada::convertAdaToCxxComments ( SgNode root,
bool  cxxLineComments = true 
)

/}

converts all Ada style comments to C++ comments

◆ convertToOperatorRepresentation()

void SageInterface::Ada::convertToOperatorRepresentation ( SgNode root,
bool  convertCallSyntax = false,
bool  convertNamedArguments = false 
)

converts AST from a function call representation to operator form for fundamental operator declarations.

Parameters
rootthe subtree is traversed to find operator calls (using the traversal mechanism)
convertCallSyntaxfalse, only convert those calls where get_uses_operator_syntax() returns false true, convert all calls (may result in invalid Ada)
convertNamedArgumentsnot relevant, when convertCallSyntax == false true, named arguments are resolved false, named arguments are preserved