RecoverForXCompilationUnit

io.joern.x2cpg.passes.frontend.RecoverForXCompilationUnit
abstract class RecoverForXCompilationUnit[CompilationUnitType <: AstNode](cpg: Cpg, cu: CompilationUnitType, builder: DiffGraphBuilder, globalTable: SymbolTable[GlobalKey], addedNodes: Set[(Long, String)]) extends RecursiveTask[Unit]

Performs type recovery from the root of a compilation unit level

Attributes

CompilationUnitType

the AstNode type used to represent a compilation unit of the language.

addedNodes

new node tracking set.

builder

the graph builder

cpg

the graph.

cu

a compilation unit, e.g. file, procedure, type, etc.

globalTable

the global symbol table.

Graph
Supertypes
class RecursiveTask[Unit]
class ForkJoinTask[Unit]
trait Serializable
trait Future[Unit]
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Abstract methods

protected def isConstructor(c: Call): Boolean

A heuristic method to determine if a call is a constructor or not.

A heuristic method to determine if a call is a constructor or not.

Attributes

protected def visitImport(i: Call): Unit

Refers to the declared import information. This is for legacy import notation.

Refers to the declared import information. This is for legacy import notation.

Attributes

i

the call that imports entities into this scope.

Concrete methods

protected def assignTypesToCall(x: Call, types: Set[String]): Set[String]

Given a LHS call, will retrieve its symbol to the given types.

Given a LHS call, will retrieve its symbol to the given types.

Attributes

protected def assignments: Traversal[Assignment]
protected def associateInterproceduralTypes(i: Identifier, base: Identifier, fi: FieldIdentifier, fieldName: String, baseTypes: Set[String]): Set[String]

Similar to associateTypes but used in the case where there is some kind of field load.

Similar to associateTypes but used in the case where there is some kind of field load.

Attributes

protected def associateInterproceduralTypes(i: Identifier, fieldFullName: String, fieldName: String, globalTypes: Set[String], baseTypes: Set[String]): Set[String]
protected def associateTypes(i: Identifier, types: Set[String]): Set[String]

Associates the types with the identifier. This may sometimes be an identifier that should be considered a field which this method uses isField to determine.

Associates the types with the identifier. This may sometimes be an identifier that should be considered a field which this method uses isField to determine.

Attributes

protected def associateTypes(symbol: LocalVar, fa: FieldAccess, types: Set[String]): Set[String]

Associates the types with the identifier. This may sometimes be an identifier that should be considered a field which this method uses isField to determine.

Associates the types with the identifier. This may sometimes be an identifier that should be considered a field which this method uses isField to determine.

Attributes

override def compute(): Unit

Attributes

Definition Classes
RecursiveTask
protected def getFieldBaseType(base: Identifier, fi: FieldIdentifier): Set[String]
protected def getFieldBaseType(baseName: String, fieldName: String): Set[String]
protected def getFieldName(fa: FieldAccess, prefix: String, suffix: String): String

Extracts a string representation of the name of the field within this field access.

Extracts a string representation of the name of the field within this field access.

Attributes

protected def getFieldParents(fa: FieldAccess): Set[String]

Returns the appropriate field parent scope.

Returns the appropriate field parent scope.

Attributes

protected def getIndexAccessTypes(ia: Call): Set[String]

Will attempt to retrieve index access types otherwise will return dummy value.

Will attempt to retrieve index access types otherwise will return dummy value.

Attributes

protected def getLiteralType(l: Literal): Set[String]

Not all frontends populate typeFullName for literals so we allow this to be overridden.

Not all frontends populate typeFullName for literals so we allow this to be overridden.

Attributes

protected def getSymbolFromCall(c: Call): (LocalKey, Set[GlobalKey])

Tries to identify the underlying symbol from the call operation as it is used on the LHS of an assignment. The second element is a list of any associated global keys if applicable.

Tries to identify the underlying symbol from the call operation as it is used on the LHS of an assignment. The second element is a list of any associated global keys if applicable.

Attributes

protected def getTypesFromCall(c: Call): Set[String]

Given a call operation, will attempt to retrieve types from it.

Given a call operation, will attempt to retrieve types from it.

Attributes

protected def importNodes(cu: AstNode): Traversal[AstNode]

Attributes

Returns:

the import nodes of this compilation unit.

protected def indexAccessToCollectionVar(c: Call): Option[CollectionVar]

Generates an identifier for collection/index-access operations in the symbol table.

Generates an identifier for collection/index-access operations in the symbol table.

Attributes

protected def isField(i: Identifier): Boolean

A heuristic method to determine if an identifier may be a field or not. The result means that it would be stored in the global symbol table. By default this checks if the identifier name matches a member name.

A heuristic method to determine if an identifier may be a field or not. The result means that it would be stored in the global symbol table. By default this checks if the identifier name matches a member name.

Attributes

protected def members: Traversal[Member]
protected def methodReturnValues(methodFullNames: Seq[String]): Set[String]

Will attempt to find the return values of a method if in the CPG, otherwise will give a dummy value.

Will attempt to find the return values of a method if in the CPG, otherwise will give a dummy value.

Attributes

protected def postVisitImports(): Unit

The initial import setting is over-approximated, so this step checks the CPG for any matches and prunes against these findings. If there are no findings, it will leave the table as is. The latter is significant for external types or methods.

The initial import setting is over-approximated, so this step checks the CPG for any matches and prunes against these findings. If there are no findings, it will leave the table as is. The latter is significant for external types or methods.

Attributes

Provides an entrypoint to add known symbols and their possible types.

Provides an entrypoint to add known symbols and their possible types.

Attributes

protected def setCallMethodFullNameFromBase(c: Call): Set[String]

Will build a call full path using the call base node. This method assumes the base node is in the symbol table.

Will build a call full path using the call base node. This method assumes the base node is in the symbol table.

Attributes

protected def setTypeInformation(): Unit

Using an entry from the symbol table, will queue the CPG modification to persist the recovered type information.

Using an entry from the symbol table, will queue the CPG modification to persist the recovered type information.

Attributes

protected def visitAssignments(a: Assignment): Set[String]

Using assignment and import information (in the global symbol table), will propagate these types in the symbol table.

Using assignment and import information (in the global symbol table), will propagate these types in the symbol table.

Attributes

a

assignment call pointer.

protected def visitCall(call: Call): Unit

For each call that contains the returnValue directive, attempt to replace the return value by the dynamic

For each call that contains the returnValue directive, attempt to replace the return value by the dynamic

Attributes

protected def visitCallAssignedToBlock(c: Call, b: Block): Set[String]

Visits a call operation being assigned to the result of some operation.

Visits a call operation being assigned to the result of some operation.

Attributes

protected def visitCallAssignedToCall(x: Call, y: Call): Set[String]

Visits a call assigned to the return value of a call. This is often when there are operators involved.

Visits a call assigned to the return value of a call. This is often when there are operators involved.

Attributes

protected def visitCallAssignedToIdentifier(c: Call, i: Identifier): Set[String]

Visits a call assigned to an identifier. This is often when there are operators involved.

Visits a call assigned to an identifier. This is often when there are operators involved.

Attributes

protected def visitCallAssignedToLiteral(c: Call, l: Literal): Set[String]
protected def visitCallAssignedToMethodRef(c: Call, m: MethodRef): Set[String]

Handles a call operation assigned to a method/function pointer.

Handles a call operation assigned to a method/function pointer.

Attributes

protected def visitIdentifierAssignedToBlock(i: Identifier, b: Block): Set[String]

Visits an identifier being assigned to the result of some operation.

Visits an identifier being assigned to the result of some operation.

Attributes

protected def visitIdentifierAssignedToCall(i: Identifier, c: Call): Set[String]

Visits an identifier being assigned to a call. This call could be an operation, function invocation, or constructor invocation.

Visits an identifier being assigned to a call. This call could be an operation, function invocation, or constructor invocation.

Attributes

protected def visitIdentifierAssignedToCallRetVal(i: Identifier, c: Call): Set[String]

Visits an identifier being assigned to a call's return value.

Visits an identifier being assigned to a call's return value.

Attributes

protected def visitIdentifierAssignedToConstructor(i: Identifier, c: Call): Set[String]

Visits an identifier being assigned to a constructor and attempts to speculate the constructor path.

Visits an identifier being assigned to a constructor and attempts to speculate the constructor path.

Attributes

protected def visitIdentifierAssignedToFieldLoad(i: Identifier, fa: FieldAccess): Set[String]

Will handle an identifier being assigned to a field value.

Will handle an identifier being assigned to a field value.

Attributes

protected def visitIdentifierAssignedToIdentifier(x: Identifier, y: Identifier): Set[String]

Visits an identifier being assigned to the value held by another identifier. This is a weak copy.

Visits an identifier being assigned to the value held by another identifier. This is a weak copy.

Attributes

protected def visitIdentifierAssignedToIndexAcess(i: Identifier, c: Call): Set[String]

Visits an identifier being assigned to the result of an index access operation.

Visits an identifier being assigned to the result of an index access operation.

Attributes

protected def visitIdentifierAssignedToLiteral(i: Identifier, l: Literal): Set[String]

Will handle literal value assignments. Override if special handling is required.

Will handle literal value assignments. Override if special handling is required.

Attributes

protected def visitIdentifierAssignedToMethodRef(i: Identifier, m: MethodRef): Set[String]

Will handle an identifier holding a function pointer.

Will handle an identifier holding a function pointer.

Attributes

protected def visitIdentifierAssignedToOperator(i: Identifier, c: Call, operation: String): Set[String]

Visits an identifier being assigned to an operator call.

Visits an identifier being assigned to an operator call.

Attributes

protected def visitIdentifierAssignedToTypeRef(i: Identifier, t: TypeRef): Set[String]

Will handle an identifier holding a type pointer.

Will handle an identifier holding a type pointer.

Attributes

protected def visitImport(i: Import): Unit

Visits an import and stores references in the symbol table as both an identifier and call.

Visits an import and stores references in the symbol table as both an identifier and call.

Attributes

protected def visitImports(procedureDeclarations: Traversal[AstNode]): Unit

Using import information and internally defined procedures, will generate a mapping between how functions and types are aliased and called and themselves.

Using import information and internally defined procedures, will generate a mapping between how functions and types are aliased and called and themselves.

Attributes

procedureDeclarations

imports to types or functions and internally defined methods themselves.

protected def visitParameter(param: MethodParameterIn): Unit
protected def visitStatementsInBlock(b: Block): Set[String]

Process each statement but only assign the type of the last statement to the identifier

Process each statement but only assign the type of the last statement to the identifier

Attributes

Inherited methods

def cancel(x$0: Boolean): Boolean

Attributes

Inherited from:
ForkJoinTask
final def compareAndSetForkJoinTaskTag(x$0: Short, x$1: Short): Boolean

Attributes

Inherited from:
ForkJoinTask
def complete(x$0: Unit): Unit

Attributes

Inherited from:
ForkJoinTask
def completeExceptionally(x$0: Throwable): Unit

Attributes

Inherited from:
ForkJoinTask
final def fork(): ForkJoinTask[V]

Attributes

Inherited from:
ForkJoinTask
final def get(x$0: Long, x$1: TimeUnit): V

Attributes

Inherited from:
ForkJoinTask
final def get(): V

Attributes

Inherited from:
ForkJoinTask
final def getException(): Throwable

Attributes

Inherited from:
ForkJoinTask
final def getForkJoinTaskTag(): Short

Attributes

Inherited from:
ForkJoinTask
final def getRawResult(): V

Attributes

Inherited from:
RecursiveTask
final def invoke(): V

Attributes

Inherited from:
ForkJoinTask
final def isCancelled(): Boolean

Attributes

Inherited from:
ForkJoinTask
final def isCompletedAbnormally(): Boolean

Attributes

Inherited from:
ForkJoinTask
final def isCompletedNormally(): Boolean

Attributes

Inherited from:
ForkJoinTask
final def isDone(): Boolean

Attributes

Inherited from:
ForkJoinTask
final def join(): V

Attributes

Inherited from:
ForkJoinTask
final def quietlyComplete(): Unit

Attributes

Inherited from:
ForkJoinTask
final def quietlyInvoke(): Unit

Attributes

Inherited from:
ForkJoinTask
final def quietlyJoin(): Unit

Attributes

Inherited from:
ForkJoinTask
def reinitialize(): Unit

Attributes

Inherited from:
ForkJoinTask
final def setForkJoinTaskTag(x$0: Short): Short

Attributes

Inherited from:
ForkJoinTask
def tryUnfork(): Boolean

Attributes

Inherited from:
ForkJoinTask

Concrete fields

protected val logger: Logger

Stores type information for local structures that live within this compilation unit, e.g. local variables.

Stores type information for local structures that live within this compilation unit, e.g. local variables.

Attributes