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

Description

Contains Ada-specific functionality.

Classes

struct  AggregateInfo
 Details of expression aggregates. More...
 
struct  IfInfo
 represents a branch in an if elsif else context (either statement or expression). More...
 
struct  ImportedUnitResult
 describes properties of imported units More...
 
struct  PrimitiveParameterDesc
 

Typedefs

using StatementRange = std::pair< SgDeclarationStatementPtrList::iterator, SgDeclarationStatementPtrList::iterator >
 
using FlatArrayType = std::pair< SgArrayType *, std::vector< SgExpression * > >
 defines the result type for getArrayTypeInfo
 
using IfExpressionInfo = IfInfo< SgExpression >
 returns a sequence of if (x) then value the last else does not have
 
using IfStatementInfo = IfInfo< SgStatement >
 

Functions

std::vector< IfExpressionInfoflattenIfExpressions (SgConditionalExp &n)
 returns a flat representation of if expressions
 
std::vector< IfStatementInfoflattenIfStatements (SgIfStmt &n)
 returns a flat representation of if-elsif-else statements
 
long long int staticIntegralValue (SgExpression *n)
 integer constant folding More...
 
SgExpressionunderlyingExpr (const SgStatement *s)
 returns the expression of an expression statement, or nullptr if s is some other node
 
ImportedUnitResult importedUnit (const SgImportStatement &impdcl)
 queries properties of an imported unit
 
const SgExpressionimportedElement (const SgImportStatement &n)
 returns the imported element (i.e., the first entry in n's import_list
 
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 + '"'). More...
 
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). More...
 
SgDeclarationStatementassociatedDecl (const SgSymbol &n)
 returns the associated declaration for symbol n or nullptr if there is none. More...
 
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
 
void convertAdaToCxxComments (SgNode *root, bool cxxLineComments=true)
 converts all Ada style comments to C++ comments
 
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. More...
 
bool withPrivateDefinition (const SgDeclarationStatement *dcl)
 tests if the declaration dcl defines a public type that is completed in a private section. More...
 
bool withPrivateDefinition (const SgDeclarationStatement &dcl)
 tests if the declaration dcl defines a public type that is completed in a private section. More...
 
bool unconstrained (const SgArrayType *ty)
 tests if ty is an unconstrained array More...
 
bool unconstrained (const SgArrayType &ty)
 tests if ty is an unconstrained array More...
 
StatementRange declsInPackage (SgGlobal &globalScope, const std::string &mainFile)
 returns all statements/declarations in the global scope that were defined in the source file. More...
 
StatementRange declsInPackage (SgGlobal &globalScope, const SgSourceFile &mainFile)
 returns all statements/declarations in the global scope that were defined in the source file. More...
 
int firstLastDimension (SgExprListExp &args)
 returns an integer value for args[0] as used by type attributes first and last More...
 
int firstLastDimension (SgExprListExp *args)
 returns an integer value for args[0] as used by type attributes first and last More...
 
FlatArrayType getArrayTypeInfo (SgType *atype)
 returns a flattened representation of Ada array types. More...
 
SgRangeExprange (const SgAdaAttributeExp *rangeAttribute)
 returns a range for the range attribute rangeAttribute. More...
 
SgRangeExprange (const SgAdaAttributeExp &rangeAttribute)
 returns a range for the range attribute rangeAttribute. More...
 
SgAdaPackageSpecDeclgetSpecificationDeclaration (const SgAdaPackageBodyDecl &bodyDecl)
 returns the declaration node for the package specification
 
SgAdaPackageSpecDeclgetSpecificationDeclaration (const SgAdaPackageBodyDecl *bodyDecl)
 returns the declaration node for the package specification
 
SgAdaPackageBodyDeclgetBodyDeclaration (const SgAdaPackageSpecDecl &specDecl)
 returns the declaration node for the package body, if available
 
SgAdaPackageBodyDeclgetBodyDeclaration (const SgAdaPackageSpecDecl *specDecl)
 returns the declaration node for the package body, if available
 
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 isFunctionTryBlock (const SgTryStmt &n)
 returns true iff n is an Ada function try block More...
 
bool isFunctionTryBlock (const SgTryStmt *n)
 returns true iff n is an Ada function try block More...
 
bool isPackageTryBlock (const SgTryStmt &n)
 returns true iff n is an Ada package try block More...
 
bool isPackageTryBlock (const SgTryStmt *n)
 returns true iff n is an Ada package try block More...
 
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 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 isFixedType (const SgType *ty)
 returns if the type ty is a fixed point type More...
 
bool isFixedType (const SgType &ty)
 returns if the type ty is a fixed point type More...
 
bool isDecimalFixedType (const SgType *ty)
 returns if the type ty is a decimal fixed point type More...
 
bool isDecimalFixedType (const SgType &ty)
 returns if the type ty is a decimal fixed point type More...
 
SgAdaGenericDeclisGenericDecl (const SgDeclarationStatement &n)
 Returns the SgAdaGenericDecl node that makes a declaration (either function/procedure or package) generic. More...
 
SgAdaGenericDeclisGenericDecl (const SgDeclarationStatement *n)
 Returns the SgAdaGenericDecl node that makes a declaration (either function/procedure or package) generic. More...
 
SgAdaGenericDeclgetGenericDecl (const SgAdaGenericInstanceDecl &n)
 Returns SgAdaGenericDecl for a given SgAdaGenericInstanceDecl. More...
 
SgAdaGenericDeclgetGenericDecl (const SgAdaGenericInstanceDecl *n)
 Returns SgAdaGenericDecl for a given SgAdaGenericInstanceDecl. More...
 
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
 
SgTypetypeRoot (SgType &)
 returns the most fundamental type after skipping derived types, subtypes, typedefs, etc.
 
SgTypetypeRoot (SgType *)
 returns the most fundamental type after skipping derived types, subtypes, typedefs, etc.
 
SgTypetypeOfExpr (SgExpression &)
 returns the type of an expression corrects for some peculiarities in the AST More...
 
SgTypetypeOfExpr (SgExpression *)
 returns the type of an expression corrects for some peculiarities in the AST More...
 
SgScopeStatementscopeOfTypedecl (const SgType &ty)
 returns the scope where ty was defined
 
SgScopeStatementscopeOfTypedecl (const SgType *ty)
 returns the scope where ty was defined
 
SgDeclarationStatementassociatedDeclaration (const SgType &ty)
 returns the scope where ty was defined More...
 
SgDeclarationStatementassociatedDeclaration (const SgType *ty)
 returns the scope where ty was defined More...
 
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 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 &)
 returns the descriptions for parameters that make an operations primitive
 
std::vector< PrimitiveParameterDescprimitiveParameterPositions (const SgFunctionDeclaration *)
 returns the descriptions for parameters that make an operations primitive
 
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). More...
 
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. More...
 
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. More...
 
SgDeclarationStatementbaseDeclaration (SgType &ty)
 finds the type declaration of a type ty More...
 
SgDeclarationStatementbaseDeclaration (SgType *ty)
 finds the type declaration of a type ty More...
 
const SgScopeStatementlogicalParentScope (const SgScopeStatement &s)
 returns the logical parent scope of a scope s. More...
 
const SgScopeStatementlogicalParentScope (const SgScopeStatement *s)
 returns the logical parent scope of a scope s. More...
 
SgEnumDeclarationbaseEnumDeclaration (SgType *ty)
 finds the underlying enum declaration of a type ty More...
 
SgEnumDeclarationbaseEnumDeclaration (SgType &ty)
 finds the underlying enum declaration of a type ty More...
 
size_t positionalArgumentLimit (const SgExpressionPtrList &arglst)
 finds the one past the last positional argument (aka the first named argument position). More...
 
size_t positionalArgumentLimit (const SgExprListExp &args)
 finds the one past the last positional argument (aka the first named argument position). More...
 
size_t positionalArgumentLimit (const SgExprListExp *args)
 finds the one past the last positional argument (aka the first named argument position). More...
 
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
 

Variables

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

Function Documentation

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.
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.
bool SageInterface::Ada::unconstrained ( const SgArrayType ty)

tests if ty is an unconstrained array

Returns
true iff ty is unconstrained
bool SageInterface::Ada::unconstrained ( const SgArrayType ty)

tests if ty is an unconstrained array

Returns
true iff ty is unconstrained
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.

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.

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
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
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 is not an arraytype, a pair <nullptr, empty vector> is returned otherwise a pair of a 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).
Precondition
atype is not null.
long long int SageInterface::Ada::staticIntegralValue ( SgExpression n)

integer constant folding

Returns
an integral value for an Ada expression if possible
Exceptions
anexception otherwise.
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
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
bool SageInterface::Ada::isFunctionTryBlock ( const SgTryStmt n)

returns true iff n is an Ada function 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.
bool SageInterface::Ada::isFunctionTryBlock ( const SgTryStmt n)

returns true iff n is an Ada function 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.
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.
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.
bool SageInterface::Ada::isFixedType ( const SgType ty)

returns if the type ty is a fixed point type

also return true for decimal fixed points

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

returns if the type ty is a fixed point type

also return true for decimal fixed points

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

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

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.

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.

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

Returns SgAdaGenericDecl for a given SgAdaGenericInstanceDecl.

skips over intermediate renaming declarations.

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

Returns SgAdaGenericDecl for a given SgAdaGenericInstanceDecl.

skips over intermediate renaming declarations.

SgType* SageInterface::Ada::typeOfExpr ( SgExpression )

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

SgType* SageInterface::Ada::typeOfExpr ( SgExpression )

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

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

returns the scope where ty was defined

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

returns the scope where ty was defined

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.

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

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).
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
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
SgDeclarationStatement* SageInterface::Ada::baseDeclaration ( SgType ty)

finds the type declaration of a type ty

Returns
returns the first named base declaration of ty nullptr if no declaration can be found

Skips over intermediate derived types, subtypes, etc. until a SgNamedType is found. Returns the declaration of said type.

SgDeclarationStatement* SageInterface::Ada::baseDeclaration ( SgType ty)

finds the type declaration of a type ty

Returns
returns the first named base declaration of ty nullptr if no declaration can be found

Skips over intermediate derived types, subtypes, etc. until a SgNamedType is found. Returns the declaration of said type.

const 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.

const 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.

SgDeclarationStatement* SageInterface::Ada::associatedDecl ( const SgSymbol n)

returns the associated declaration for symbol n or nullptr if there is none.

SgEnumDeclaration* SageInterface::Ada::baseEnumDeclaration ( 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

in contrast to baseDeclaration, baseEnumDeclaration skips over intermediate SgTypedefDeclarations that introduce a new type or a subtype.

SgEnumDeclaration* SageInterface::Ada::baseEnumDeclaration ( 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

in contrast to baseDeclaration, baseEnumDeclaration skips over intermediate SgTypedefDeclarations that introduce a new type or a subtype.

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
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
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
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