Package-level declarations

Types

Link copied to clipboard

A ComponentPass is a pass that operates on a Component. If used with executePass, one Pass object is instantiated for each Component in a TranslationResult.

Link copied to clipboard

This pass builds the Control Dependence Graph (CDG) by iterating through the EOG.

Link copied to clipboard

This pass determines the data flows of References which refer to a VariableDeclaration (not a field) while considering the control flow of a function. After this path, only such data flows are left which can occur when following the control flow (in terms of the EOG) of the program.

Link copied to clipboard

Adds the DFG edges for various types of nodes.

Link copied to clipboard

This Pass is responsible for resolving dynamic function invokes, i.e., CallExpression nodes that contain a reference/pointer to a function and are being "called". A common example includes C/C++ function pointers.

Link copied to clipboard
abstract class EOGStarterPass(ctx: TranslationContext) : Pass<Node>

A EOGStarterPass is a pass that operates on nodes that are contained in a EOGStarterHolder. If used with executePass, one Pass object is instantiated for each Node in a EOGStarterHolder in each TranslationUnitDeclaration in each Component.

Link copied to clipboard

Creates an Evaluation Order Graph (EOG) based on the CPG's version of the AST. The expected outcomes are specified in the Specification.

Link copied to clipboard
Link copied to clipboard

This class holds the information about import dependencies between TranslationUnitDeclaration nodes. The dependency is based on which translation unit imports symbols of another translation unit (usually in the form of a NamespaceDeclaration). The idea is to provide a sorted list of TUs in which to resolve symbols and imports ideally. This is stored in sortedTranslationUnits and is automatically computed the fist time someone accesses the property.

Link copied to clipboard

This pass looks for ImportDeclaration nodes and imports symbols into their respective Scope. It does so by first building a dependency map between TranslationUnitDeclaration nodes, based on their ImportDeclaration nodes.

Link copied to clipboard

Represents an abstract class that enhances the graph before it is persisted. Passes can exist at three different levels:

Link copied to clipboard
Link copied to clipboard

Pass with some graph transformations useful when doing serialization.

Link copied to clipboard

Implements the LatticeElement over a set of nodes and their set of "nextEOG" nodes which reach this node.

Link copied to clipboard

A state which actually holds a state for all Edges. It maps the node to its BranchingNode-parent and the path through which it is reached.

Link copied to clipboard

This pass collects the dependence information of each node into a Program Dependence Graph (PDG) by traversing through the AST.

Link copied to clipboard

If a Language has the trait HasCallExpressionAmbiguity, we cannot distinguish between CallExpression, CastExpression or ConstructExpression during the initial translation. This stems from the fact that we might not know all the types yet. We therefore need to handle them as regular call expression in a LanguageFrontend or Handler and then later replace them with a CastExpression or ConstructExpression, if the CallExpression.callee refers to name of a Type / RecordDeclaration rather than a function.

Link copied to clipboard

A translation unit pass that resolves ambiguities in member expressions within a translation unit. This pass checks whether the base or member name in a member expression refers to an import and, if so, replaces the member expression with a reference using the fully qualified name.

Link copied to clipboard

A Pass collecting statistics for the graph. Currently, it collects the number of nodes and the number of problem nodes (i.e., nodes where the translation failed for some reason).

Link copied to clipboard

Creates new connections between the place where a variable is declared and where it is used.

Link copied to clipboard

A TranslationResultPass is a pass that operates on a TranslationResult. If used with executePass, one Pass object is instantiated for the whole TranslationResult.

Link copied to clipboard

A TranslationUnitPass is a pass that operates on a TranslationUnitDeclaration. If used with executePass, one Pass object is instantiated for each TranslationUnitDeclaration in a Component.

Link copied to clipboard

Transitively connect RecordDeclaration nodes with their supertypes' records.

Link copied to clipboard

The purpose of this Pass is to establish a relationship between Type nodes (more specifically ObjectTypes) and their RecordDeclaration.

Properties

Link copied to clipboard
val KClass<out Pass<*>>.hardDependencies: Set<KClass<out Pass<*>>>
Link copied to clipboard
val KClass<out Pass<*>>.hardExecuteBefore: Set<KClass<out Pass<*>>>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

This utility function tries to reconstruct the name as if the expression was part of an imported symbol. This is needed because the MemberExpression.name includes the MemberExpression.base's type instead of the name, and thus it might be "UNKNOWN".

Link copied to clipboard
val KClass<out Pass<*>>.softDependencies: Set<KClass<out Pass<*>>>
Link copied to clipboard
val KClass<out Pass<*>>.softExecuteBefore: Set<KClass<out Pass<*>>>

Functions

Link copied to clipboard

Adds the resolved default template arguments recursively to the templateParameter list of the ConstructExpression until a fixpoint is reached e.g. template

Link copied to clipboard
fun applyMissingParams(template: RecordTemplateDeclaration, constructExpression: ConstructExpression, templateParametersExplicitInitialization: Map<Node, Node>, templateParameterRealDefaultInitialization: Map<Node, Node?>, scopeManager: ScopeManager)

Apply missingParameters (either explicit or defaults) to the ConstructExpression and its type

Link copied to clipboard
fun applyTemplateInstantiation(templateCall: CallExpression, functionTemplateDeclaration: FunctionTemplateDeclaration?, function: FunctionDeclaration, initializationSignature: Map<Declaration?, Node?>, initializationType: Map<Node?, TemplateDeclaration.TemplateInitialization?>, orderedInitializationSignature: Map<Declaration, Int>): List<FunctionDeclaration>

Performs all necessary steps to make a CallExpression instantiate a template: 1. Set TemplateInstantiation Edge from CallExpression to Template 2. Set Invokes Edge to all realizations of the Template 3. Set return type of the CallExpression and checks if it uses a ParameterizedType and therefore has to be instantiated 4. Set Template Parameters Edge from the CallExpression to all Instantiation Values 5. Set DFG Edges from instantiation to ParameterDeclaration in TemplateDeclaration

Link copied to clipboard
fun checkArgumentValidity(functionDeclaration: FunctionDeclaration, functionDeclarationSignature: List<Type>, templateCallExpression: CallExpression, explicitInstantiation: List<ParameterizedType>, needsExactMatch: Boolean): Boolean
Link copied to clipboard
fun <T : Node> checkForReplacement(cls: KClass<out Pass<T>>, language: Language<*>?, config: TranslationConfiguration): KClass<out Pass<T>>

Checks, whether the specified pass has a replacement configured in config for the given language. Currently, we only allow replacement on translation unit level, as this is the only level which has a single language set.

Creates a Mapping between the Parameters of the TemplateDeclaration and the Values provided for the instantiation of the template (Only the ones that are in defined in the instantiation => no defaults or implicit). Additionally, it fills the maps and lists mentioned below:

Link copied to clipboard
fun executePass(cls: KClass<out Pass<out Node>>, ctx: TranslationContext, result: TranslationResult, executedFrontends: Collection<LanguageFrontend<*, *>>)

Creates a new Pass (based on cls) and executes it sequentially on all target nodes of result.

Link copied to clipboard
fun executePassesInParallel(classes: List<KClass<out Pass<*>>>, ctx: TranslationContext, result: TranslationResult, executedFrontends: Collection<LanguageFrontend<*, *>>)
Link copied to clipboard
fun getCallSignature(function: FunctionDeclaration, parameterizedTypeResolution: Map<ParameterizedType, TypeParameterDeclaration>, initializationSignature: Map<Declaration?, Node?>): List<Type>

Gets all ParameterizedTypes from the initialization signature

Link copied to clipboard
fun getTemplateInitializationSignature(functionTemplateDeclaration: FunctionTemplateDeclaration, templateCall: CallExpression, instantiationType: MutableMap<Node?, TemplateDeclaration.TemplateInitialization?>, orderedInitializationSignature: MutableMap<Declaration, Int>, explicitInstantiated: MutableList<ParameterizedType>): Map<Declaration?, Node?>?

Creates a Mapping between the Parameters of the TemplateDeclaration and the Values provided * for the instantiation of the template.

Link copied to clipboard
fun handleDefaultTemplateParameters(template: RecordTemplateDeclaration, templateParameterRealDefaultInitialization: MutableMap<Node, Node?>)

Matches declared template arguments to their defaults (without defaults of a previously defined template argument)

Link copied to clipboard

This method is executed for each EOG edge which is in the worklist. currentEdge is the edge to process, currentState contains the state which was observed before arriving here.

Link copied to clipboard
fun handleExplicitTemplateParameters(constructExpression: ConstructExpression, template: RecordTemplateDeclaration, templateParametersExplicitInitialization: MutableMap<Node, Node>)

Matches declared template arguments to the explicit instantiation

Link copied to clipboard
fun handleImplicitTemplateParameter(functionTemplateDeclaration: FunctionTemplateDeclaration, index: Int, instantiationSignature: MutableMap<Declaration?, Node?>, instantiationType: MutableMap<Node?, TemplateDeclaration.TemplateInitialization?>, orderedInitializationSignature: MutableMap<Declaration, Int>)

Check if we are handling an implicit template parameter, if so set instantiationSignature, instantiationType and orderedInitializationSignature maps accordingly

Link copied to clipboard
fun isInstantiated(callParameterArg: Node, templateParameter: Declaration?): Boolean

Checks if the provided call parameter can instantiate the required template parameter

Link copied to clipboard

The "object identifier" of a node can be used to differentiate different "objects" that a node (most likely a Reference) refers to.

Link copied to clipboard
Link copied to clipboard

In C++ if there is a method that matches the name we are looking for, we have to stop searching in the parents even if the signature of the method does not match

Link copied to clipboard
fun signatureWithImplicitCastTransformation(call: CallExpression, callSignature: List<Type?>, arguments: List<Expression>, functionSignature: List<Type>): MutableList<CastExpression?>

Computes the implicit casts that are necessary to reach the