diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/EvaluationOrderGraphPass.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/EvaluationOrderGraphPass.kt index f1a5da13771..6b043a39d22 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/EvaluationOrderGraphPass.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/EvaluationOrderGraphPass.kt @@ -35,7 +35,6 @@ import de.fraunhofer.aisec.cpg.graph.StatementHolder import de.fraunhofer.aisec.cpg.graph.declarations.* import de.fraunhofer.aisec.cpg.graph.edges.flows.EvaluationOrder import de.fraunhofer.aisec.cpg.graph.firstParentOrNull -import de.fraunhofer.aisec.cpg.graph.scopes.* import de.fraunhofer.aisec.cpg.graph.statements.* import de.fraunhofer.aisec.cpg.graph.statements.expressions.* import de.fraunhofer.aisec.cpg.graph.types.Type @@ -46,7 +45,12 @@ import java.util.* import org.slf4j.LoggerFactory /** - * Creates an Evaluation Order Graph (EOG) based on AST. + * Creates an Evaluation Order Graph (EOG) based on the CPG's version of the AST. The expected + * outcomes are specified in the + * [Specification](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog). + * + * Note: If you changed this file, make sure the specification is still in-line with the + * implementation. If you support new nodes, add a section to the specification. * * An EOG is an intra-procedural directed graph whose vertices are executable AST nodes and edges * connect them in the order they would be executed when running the program. @@ -84,7 +88,6 @@ import org.slf4j.LoggerFactory @Suppress("MemberVisibilityCanBePrivate") open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPass(ctx) { - protected val map = mutableMapOf, (Node) -> Unit>() protected var currentPredecessors = mutableListOf() protected var nextEdgeBranch: Boolean? = null @@ -99,7 +102,7 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa /** * This maps nodes that have to handle [BreakStatement]s and [ContinueStatement]s, i.e. * [LoopStatement]s and [SwitchStatement]s to the EOG exits of the node they have to handle. An - * entry will only be created if the statement was identified to handle the above mentioned + * entry will only be created if the statement was identified to handle the above-mentioned * control flow statements. */ val nodesWithContinuesAndBreaks = mutableMapOf>() @@ -117,86 +120,6 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa */ protected val intermediateNodes = mutableListOf() - init { - map[IncludeDeclaration::class.java] = { doNothing() } - map[TranslationUnitDeclaration::class.java] = { - handleTranslationUnitDeclaration(it as TranslationUnitDeclaration) - } - map[NamespaceDeclaration::class.java] = { - handleNamespaceDeclaration(it as NamespaceDeclaration) - } - map[RecordDeclaration::class.java] = { handleRecordDeclaration(it as RecordDeclaration) } - map[FunctionDeclaration::class.java] = { - handleFunctionDeclaration(it as FunctionDeclaration) - } - map[TupleDeclaration::class.java] = { handleTupleDeclaration(it as TupleDeclaration) } - map[VariableDeclaration::class.java] = { - handleVariableDeclaration(it as VariableDeclaration) - } - map[CallExpression::class.java] = { handleCallExpression(it as CallExpression) } - map[MemberExpression::class.java] = { handleMemberExpression(it as MemberExpression) } - map[SubscriptExpression::class.java] = { - handleSubscriptExpression(it as SubscriptExpression) - } - map[NewArrayExpression::class.java] = { handleNewArrayExpression(it as NewArrayExpression) } - map[RangeExpression::class.java] = { handleRangeExpression(it as RangeExpression) } - map[DeclarationStatement::class.java] = { - handleDeclarationStatement(it as DeclarationStatement) - } - map[ReturnStatement::class.java] = { handleReturnStatement(it as ReturnStatement) } - map[BinaryOperator::class.java] = { handleBinaryOperator(it as BinaryOperator) } - map[AssignExpression::class.java] = { handleAssignExpression(it as AssignExpression) } - map[UnaryOperator::class.java] = { handleUnaryOperator(it as UnaryOperator) } - map[Block::class.java] = { handleBlock(it as Block) } - map[IfStatement::class.java] = { handleIfStatement(it as IfStatement) } - map[AssertStatement::class.java] = { handleAssertStatement(it as AssertStatement) } - map[WhileStatement::class.java] = { handleWhileStatement(it as WhileStatement) } - map[DoStatement::class.java] = { handleDoStatement(it as DoStatement) } - map[ForStatement::class.java] = { handleForStatement(it as ForStatement) } - map[ForEachStatement::class.java] = { handleForEachStatement(it as ForEachStatement) } - map[TypeExpression::class.java] = { handleTypeExpression(it as TypeExpression) } - map[TryStatement::class.java] = { handleTryStatement(it as TryStatement) } - map[ContinueStatement::class.java] = { handleContinueStatement(it as ContinueStatement) } - map[DeleteExpression::class.java] = { handleDeleteExpression(it as DeleteExpression) } - map[BreakStatement::class.java] = { handleBreakStatement(it as BreakStatement) } - map[SwitchStatement::class.java] = { handleSwitchStatement(it as SwitchStatement) } - map[LabelStatement::class.java] = { handleLabelStatement(it as LabelStatement) } - map[GotoStatement::class.java] = { handleGotoStatement(it as GotoStatement) } - map[CaseStatement::class.java] = { handleCaseStatement(it as CaseStatement) } - map[SynchronizedStatement::class.java] = { - handleSynchronizedStatement(it as SynchronizedStatement) - } - map[NewExpression::class.java] = { handleNewExpression(it as NewExpression) } - map[KeyValueExpression::class.java] = { handleKeyValueExpression(it as KeyValueExpression) } - map[CastExpression::class.java] = { handleCastExpression(it as CastExpression) } - map[ExpressionList::class.java] = { handleExpressionList(it as ExpressionList) } - map[ConditionalExpression::class.java] = { - handleConditionalExpression(it as ConditionalExpression) - } - map[InitializerListExpression::class.java] = { - handleInitializerListExpression(it as InitializerListExpression) - } - map[ConstructExpression::class.java] = { - handleConstructExpression(it as ConstructExpression) - } - map[EmptyStatement::class.java] = { handleDefault(it as EmptyStatement) } - map[Literal::class.java] = { handleDefault(it) } - map[DefaultStatement::class.java] = { handleDefault(it) } - map[TypeIdExpression::class.java] = { handleDefault(it) } - map[Reference::class.java] = { handleDefault(it) } - map[CollectionComprehension::class.java] = { - handleCollectionComprehension(it as CollectionComprehension) - } - map[ComprehensionExpression::class.java] = { - handleComprehensionExpression(it as ComprehensionExpression) - } - map[LambdaExpression::class.java] = { handleLambdaExpression(it as LambdaExpression) } - map[LookupScopeStatement::class.java] = { - handleLookupScopeStatement(it as LookupScopeStatement) - } - map[ThrowExpression::class.java] = { handleThrowExpression(it as ThrowExpression) } - } - protected fun doNothing() { // Nothing to do for this node type } @@ -245,6 +168,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa } } + /** + * See + * [Specification for StatementHolder](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#statementholder) + */ protected fun handleTranslationUnitDeclaration(node: TranslationUnitDeclaration) { handleStatementHolder(node as StatementHolder) @@ -256,6 +183,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa processedListener.clearProcessed() } + /** + * See + * [Specification for StatementHolder](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#statementholder) + */ protected fun handleNamespaceDeclaration(node: NamespaceDeclaration) { handleStatementHolder(node) @@ -267,18 +198,30 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa processedListener.clearProcessed() } + /** + * See + * [Specification for VariableDeclaration](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#variabledeclaration) + */ protected fun handleVariableDeclaration(node: VariableDeclaration) { attachToEOG(node) // analyze the initializer handleEOG(node.initializer) } + /** + * See + * [Specification for TupleDeclaration](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#tupledeclaration) + */ protected fun handleTupleDeclaration(node: TupleDeclaration) { attachToEOG(node) // analyze the initializer handleEOG(node.initializer) } + /** + * See + * [Specification for StatementHolder](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#statementholder) + */ protected open fun handleRecordDeclaration(node: RecordDeclaration) { handleStatementHolder(node) currentPredecessors.clear() @@ -296,6 +239,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa } } + /** + * See + * [Specification for StatementHolder](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#statementholder) + */ protected fun handleStatementHolder(statementHolder: StatementHolder) { // separate code into static and non-static parts as they are executed in different moments, // although they can be placed in the same enclosing declaration. @@ -316,6 +263,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa currentPredecessors.clear() } + /** + * See + * [Specification for LambdaExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#lambdaexpression) + */ protected fun handleLambdaExpression(node: LambdaExpression) { val tmpCurrentEOG = currentPredecessors.toMutableList() val tmpCurrentProperties = nextEdgeBranch @@ -338,6 +289,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification for FunctionDeclaration](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#functiondeclaration) + */ protected open fun handleFunctionDeclaration(node: FunctionDeclaration) { // reset EOG currentPredecessors.clear() @@ -387,33 +342,128 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa */ protected fun handleEOG(node: Node?) { if (node == null) { - // nothing to do return } - intermediateNodes.add(node) - var toHandle: Class<*> = node.javaClass - var callable = map[toHandle] - while (callable == null) { - toHandle = toHandle.superclass - callable = map[toHandle] - if (toHandle == Node::class.java || !Node::class.java.isAssignableFrom(toHandle)) break - } - if (callable != null) { - callable(node) - } else { - LOGGER.info("Parsing of type ${node.javaClass} is not supported (yet)") + + when (node) { + is TranslationUnitDeclaration -> handleTranslationUnitDeclaration(node) + is NamespaceDeclaration -> handleNamespaceDeclaration(node) + is RecordDeclaration -> handleRecordDeclaration(node) + is FunctionDeclaration -> handleFunctionDeclaration(node) + is TupleDeclaration -> handleTupleDeclaration(node) + is VariableDeclaration -> handleVariableDeclaration(node) + is ConstructExpression -> handleConstructExpression(node) + is CallExpression -> handleCallExpression(node) + is MemberExpression -> handleMemberExpression(node) + is SubscriptExpression -> handleSubscriptExpression(node) + is NewArrayExpression -> handleNewArrayExpression(node) + is RangeExpression -> handleRangeExpression(node) + is DeclarationStatement -> handleDeclarationStatement(node) + is ReturnStatement -> handleReturnStatement(node) + is BinaryOperator -> handleBinaryOperator(node) + is AssignExpression -> handleAssignExpression(node) + is UnaryOperator -> handleUnaryOperator(node) + is Block -> handleBlock(node) + is IfStatement -> handleIfStatement(node) + is AssertStatement -> handleAssertStatement(node) + is WhileStatement -> handleWhileStatement(node) + is DoStatement -> handleDoStatement(node) + is ForStatement -> handleForStatement(node) + is ForEachStatement -> handleForEachStatement(node) + is TypeExpression -> handleTypeExpression(node) + is TryStatement -> handleTryStatement(node) + is ContinueStatement -> handleContinueStatement(node) + is DeleteExpression -> handleDeleteExpression(node) + is BreakStatement -> handleBreakStatement(node) + is SwitchStatement -> handleSwitchStatement(node) + is LabelStatement -> handleLabelStatement(node) + is GotoStatement -> handleGotoStatement(node) + is CaseStatement -> handleCaseStatement(node) + is SynchronizedStatement -> handleSynchronizedStatement(node) + is NewExpression -> handleNewExpression(node) + is KeyValueExpression -> handleKeyValueExpression(node) + is CastExpression -> handleCastExpression(node) + is ExpressionList -> handleExpressionList(node) + is ConditionalExpression -> handleConditionalExpression(node) + is InitializerListExpression -> handleInitializerListExpression(node) + is CollectionComprehension -> handleCollectionComprehension(node) + is ComprehensionExpression -> handleComprehensionExpression(node) + is LambdaExpression -> handleLambdaExpression(node) + is LookupScopeStatement -> handleLookupScopeStatement(node) + is ThrowExpression -> handleThrowExpression(node) + // These nodes will be added to the eog graph but no children will be handled + is EmptyStatement -> handleDefault(node) + is Literal<*> -> handleDefault(node) + is DefaultStatement -> handleDefault(node) + is TypeIdExpression -> handleDefault(node) + is Reference -> handleDefault(node) + // These nodes are not added to the EOG + is IncludeDeclaration -> doNothing() + else -> LOGGER.info("Parsing of type ${node.javaClass} is not supported (yet)") } } /** - * Default handler for nodes. The node is simply attacked to the EOG and the ast subtree is + * Default handler for nodes. The node is simply attached to the EOG and the ast subtree is * ignored. */ protected fun handleDefault(node: Node) { attachToEOG(node) } + /** + * See + * [Specification for EmptyStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#emptystatement) + */ + private fun handleEmptyStatement(node: EmptyStatement) { + attachToEOG(node) + } + + /** + * See + * [Specification for Literal](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#literal) + */ + private fun handleLiteral(node: Literal<*>) { + attachToEOG(node) + } + + /** + * See + * [Specification for DefaultStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#defaultstatement) + */ + private fun handleDefaultStatement(node: DefaultStatement) { + attachToEOG(node) + } + + /** + * See + * [Specification for TypeIdExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#typeidexpression) + */ + private fun handleTypeIdExpression(node: TypeIdExpression) { + attachToEOG(node) + } + + /** + * See + * [Specification for Reference](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#reference) + */ + private fun handleReference(node: Reference) { + attachToEOG(node) + } + + /** + * See + * [Specification for IncludeDeclaration](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#includedeclaration) + */ + protected fun handleIncludeDeclaration() { + doNothing() + } + + /** + * See + * [Specification for CallExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#callexpression) + */ protected fun handleCallExpression(node: CallExpression) { // Todo add call as throwexpression to outer scope of call can throw (which is trivial to // find out for java, but impossible for c++) @@ -429,11 +479,19 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification for MemberExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#memberexpression) + */ protected fun handleMemberExpression(node: MemberExpression) { handleEOG(node.base) attachToEOG(node) } + /** + * See + * [Specification for SubscriptExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#subscriptexpression) + */ protected fun handleSubscriptExpression(node: SubscriptExpression) { // Connect according to evaluation order, first the array reference, then the contained // index. @@ -442,6 +500,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification for NewArrayExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#newarrayexpression) + */ protected fun handleNewArrayExpression(node: NewArrayExpression) { for (dimension in node.dimensions) { handleEOG(dimension) @@ -450,6 +512,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification for RangeExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#rangeexpression) + */ protected fun handleRangeExpression(node: RangeExpression) { handleEOG(node.floor) handleEOG(node.ceiling) @@ -457,6 +523,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification for DeclarationStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#declarationexpression) + */ protected fun handleDeclarationStatement(node: DeclarationStatement) { // loop through declarations for (declaration in node.declarations) { @@ -482,6 +552,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification for ReturnStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#returnstatement) + */ protected fun handleReturnStatement(node: ReturnStatement) { // analyze the return value handleEOG(node.returnValue) @@ -489,16 +563,20 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa // push the statement itself attachToEOG(node) - // reset the state afterwards, we're done with this function + // reset the state afterward, we're done with this function currentPredecessors.clear() } + /** + * See + * [Specification for BinaryOperator](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#binaryoperator) + */ protected fun handleBinaryOperator(node: BinaryOperator) { handleEOG(node.lhs) val lang = node.language // Two operators that don't evaluate the second operator if the first evaluates to a certain // value. If the language has the trait of short-circuit evaluation, we check if the - // operatorCode is amongst the operators that leed such an evaluation. + // operatorCode is amongst the operators that lead to such an evaluation. if ( lang != null && lang is HasShortCircuitOperators && @@ -515,7 +593,7 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa handleEOG(node.rhs) attachToEOG(node) setCurrentEOGs(shortCircuitNodes) - // Inverted property to assigne false when true was assigned above. + // Inverted property to assign false when true was assigned above. nextEdgeBranch = !lang.conjunctiveOperators.contains(node.operatorCode) } else { handleEOG(node.rhs) @@ -523,6 +601,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification for AssignExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#assignexpression) + */ protected fun handleAssignExpression(node: AssignExpression) { for (declaration in node.declarations) { handleEOG(declaration) @@ -542,6 +624,9 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See [Specification for Block](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#block) + */ protected fun handleBlock(node: Block) { // analyze the contained statements @@ -551,6 +636,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification for UnaryOperator](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#unaryoperator) + */ protected fun handleUnaryOperator(node: UnaryOperator) { handleUnspecificUnaryOperator(node) } @@ -558,8 +647,8 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa /** * This function handles all regular unary operators that do not receive any special handling * (such as [handleThrowOperator]). This gives language frontends a chance to override this - * function using [ReplacePass], handle specific operators on their own and delegate the rest to - * this function. + * function using [de.fraunhofer.aisec.cpg.passes.configuration.ReplacePass], handle specific + * operators on their own and delegate the rest to this function. */ protected open fun handleUnspecificUnaryOperator(node: UnaryOperator) { val input = node.input @@ -568,6 +657,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification fir AssertStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#assertstatement) + */ protected fun handleAssertStatement(node: AssertStatement) { handleEOG(node.condition) val openConditionEOGs = currentPredecessors.toMutableList() @@ -576,10 +669,18 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification for TypeExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#typeexpression) + */ protected fun handleTypeExpression(node: TypeExpression) { attachToEOG(node) } + /** + * See + * [Specification for TryStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#trystatement) + */ protected fun handleTryStatement(node: TryStatement) { node.resources.forEach { handleEOG(it) } @@ -666,6 +767,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification for ContinueStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#continuestatement) + */ protected fun handleContinueStatement(node: ContinueStatement) { attachToEOG(node) val label = node.label @@ -673,8 +778,8 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa if (label == null) { node.firstParentOrNull { it.isContinuable() } } else { - // If a label was specified, the continue is associated to a node explicitly labeled - // with the same label + // If a label was specified, the continue statement is associated to a node + // explicitly labeled with the same label getLabeledASTNode(node, label) } if (continuableNode != null) { @@ -690,6 +795,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa currentPredecessors.clear() } + /** + * See + * [Specification for DeleteExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#deleteexpression) + */ protected fun handleDeleteExpression(node: DeleteExpression) { for (operand in node.operands) { handleEOG(operand) @@ -697,6 +806,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification for BreakStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#breakstatement) + */ protected fun handleBreakStatement(node: BreakStatement) { attachToEOG(node) val label = node.label @@ -717,11 +830,19 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa currentPredecessors.clear() } + /** + * See + * [Specification for LabelStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#labelstatement) + */ protected fun handleLabelStatement(node: LabelStatement) { node.scope?.addLabelStatement(node) handleEOG(node.subStatement) } + /** + * See + * [Specification for GotoStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#gotostatement) + */ protected fun handleGotoStatement(node: GotoStatement) { attachToEOG(node) node.targetLabel?.let { @@ -730,27 +851,47 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa currentPredecessors.clear() } + /** + * See + * [Specification for CaseStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#casestatement) + */ protected fun handleCaseStatement(node: CaseStatement) { handleEOG(node.caseExpression) attachToEOG(node) } + /** + * See + * [Specification for NewExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#newexpression) + */ protected fun handleNewExpression(node: NewExpression) { handleEOG(node.initializer) attachToEOG(node) } + /** + * See + * [Specification for KeyValueExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#keyvalueexpression) + */ protected fun handleKeyValueExpression(node: KeyValueExpression) { handleEOG(node.key) handleEOG(node.value) attachToEOG(node) } + /** + * See + * [Specification for CastExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#castexpression) + */ protected fun handleCastExpression(node: CastExpression) { handleEOG(node.expression) attachToEOG(node) } + /** + * See + * [Specification for ExpressionList](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#expressionlist) + */ protected fun handleExpressionList(node: ExpressionList) { for (expr in node.expressions) { handleEOG(expr) @@ -758,6 +899,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification for InitializerListExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#initializerlistexpression) + */ protected fun handleInitializerListExpression(node: InitializerListExpression) { // first the arguments for (inits in node.initializers) { @@ -766,6 +911,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification for ConstructExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#constructexpression) + */ protected fun handleConstructExpression(node: ConstructExpression) { // first the arguments for (arg in node.arguments) { @@ -871,12 +1020,20 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa prevs.forEach { prev -> addEOGEdge(prev, next) } } + /** + * See + * [Specification for SynchronizedStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#synchronizedstatement) + */ protected fun handleSynchronizedStatement(node: SynchronizedStatement) { handleEOG(node.expression) attachToEOG(node) handleEOG(node.block) } + /** + * See + * [Specification for ConditionalExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#conditionalexpression) + */ protected fun handleConditionalExpression(node: ConditionalExpression) { val openBranchNodes = mutableListOf() handleEOG(node.condition) @@ -893,6 +1050,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa setCurrentEOGs(openBranchNodes) } + /** + * See + * [Specification for DoStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#dostatement) + */ protected fun handleDoStatement(node: DoStatement) { handleEOG(node.statement) handleEOG(node.condition) @@ -906,6 +1067,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa handleContainedBreaksAndContinues(node) } + /** + * See + * [Specification for ComprehensionExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#comprehensionexpression) + */ private fun handleComprehensionExpression(node: ComprehensionExpression) { handleEOG(node.iterable) // When the iterable contains another element, the variable is evaluated with the @@ -923,6 +1088,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa nextEdgeBranch = true } + /** + * See + * [Specification for CollectionComprehension](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#collectioncomprehension) + */ private fun handleCollectionComprehension(node: CollectionComprehension) { // Process the comprehension expressions from 0 to n and connect the EOG of i to i+1. var prevComprehensionExpression: ComprehensionExpression? = null @@ -960,6 +1129,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa attachToEOG(node) } + /** + * See + * [Specification for ForEachStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#foreachstatement) + */ protected fun handleForEachStatement(node: ForEachStatement) { handleEOG(node.iterable) handleEOG(node.variable) @@ -977,6 +1150,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa nextEdgeBranch = false } + /** + * See + * [Specification for ForStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#forstatement) + */ protected fun handleForStatement(node: ForStatement) { handleEOG(node.initializerStatement) handleEOG(node.conditionDeclaration) @@ -998,6 +1175,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa nextEdgeBranch = false } + /** + * See + * [Specification for IfStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#ifstatement) + */ protected fun handleIfStatement(node: IfStatement) { val openBranchNodes = mutableListOf() handleEOG(node.initializerStatement) @@ -1019,6 +1200,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa setCurrentEOGs(openBranchNodes) } + /** + * See + * [Specification for SwitchStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#switchstatement) + */ protected fun handleSwitchStatement(node: SwitchStatement) { handleEOG(node.initializerStatement) handleEOG(node.selectorDeclaration) @@ -1051,6 +1236,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa currentPredecessors.addAll(nodesWithContinuesAndBreaks[node] ?: mutableListOf()) } + /** + * See + * [Specification for WhileStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#whilestatement) + */ protected fun handleWhileStatement(node: WhileStatement) { handleEOG(node.conditionDeclaration) handleEOG(node.condition) @@ -1068,6 +1257,10 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa handleContainedBreaksAndContinues(node) } + /** + * See + * [Specification for LookupScopeStatement](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#lookupScopestatement) + */ private fun handleLookupScopeStatement(stmt: LookupScopeStatement) { // Include the node as part of the EOG itself, but we do not need to go into any children or // properties here @@ -1084,7 +1277,12 @@ open class EvaluationOrderGraphPass(ctx: TranslationContext) : TranslationUnitPa return null } - /** Calls [handleThrowOperator]. */ + /** + * Calls [handleThrowOperator]. + * + * See + * [Specification for ThrowExpression](https://fraunhofer-aisec.github.io/cpg/CPG/specs/eog/#throwexpression) + */ protected fun handleThrowExpression(throwExpression: ThrowExpression) { handleThrowOperator( throwExpression, diff --git a/cpg-language-cxx/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/cxx/ExpressionHandler.kt b/cpg-language-cxx/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/cxx/ExpressionHandler.kt index 4f2a7bd0a44..464b7bc4a24 100644 --- a/cpg-language-cxx/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/cxx/ExpressionHandler.kt +++ b/cpg-language-cxx/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/cxx/ExpressionHandler.kt @@ -30,7 +30,6 @@ import de.fraunhofer.aisec.cpg.graph.declarations.FunctionDeclaration import de.fraunhofer.aisec.cpg.graph.declarations.MethodDeclaration import de.fraunhofer.aisec.cpg.graph.statements.expressions.* import de.fraunhofer.aisec.cpg.graph.types.FunctionType -import de.fraunhofer.aisec.cpg.graph.types.SecondOrderType import de.fraunhofer.aisec.cpg.graph.types.Type import de.fraunhofer.aisec.cpg.helpers.Util import de.fraunhofer.aisec.cpg.passes.SymbolResolver.Companion.addImplicitTemplateParametersToCall @@ -428,8 +427,6 @@ class ExpressionHandler(lang: CXXLanguageFrontend) : val callExpression: CallExpression when { reference is MemberExpression -> { - val baseType = reference.base.type.root - assert(baseType !is SecondOrderType) callExpression = newMemberCallExpression(reference, rawNode = ctx) if ( (ctx.functionNameExpression as? IASTFieldReference)?.fieldName diff --git a/cpg-language-typescript/src/main/nodejs/package-lock.json b/cpg-language-typescript/src/main/nodejs/package-lock.json index c3e47c71d1e..cf5c47fa989 100644 --- a/cpg-language-typescript/src/main/nodejs/package-lock.json +++ b/cpg-language-typescript/src/main/nodejs/package-lock.json @@ -152,9 +152,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.25.0.tgz", - "integrity": "sha512-CC/ZqFZwlAIbU1wUPisHyV/XRc5RydFrNLtgl3dGYskdwPZdt4HERtKm50a/+DtTlKeCq9IXFEWR+P6blwjqBA==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.27.1.tgz", + "integrity": "sha512-Y/i1fVMnP6PEllrv2yMFWIxq5axF3cIzeLHqKwKYd9FgIq0Py1qKWoHoosbxHmsokbLJtfjyH7/ebY6KTAIARQ==", "cpu": [ "arm" ], @@ -166,9 +166,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.25.0.tgz", - "integrity": "sha512-/Y76tmLGUJqVBXXCfVS8Q8FJqYGhgH4wl4qTA24E9v/IJM0XvJCGQVSW1QZ4J+VURO9h8YCa28sTFacZXwK7Rg==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.27.1.tgz", + "integrity": "sha512-WXrtqF2zOOTGjE6pNDF5oYPBlwpopSGaQPIZULbMKvchT7OyYzmUnEim0ICNAlz4qHYs4vxJOn1S4aLd930EKA==", "cpu": [ "arm64" ], @@ -180,9 +180,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.25.0.tgz", - "integrity": "sha512-YVT6L3UrKTlC0FpCZd0MGA7NVdp7YNaEqkENbWQ7AOVOqd/7VzyHpgIpc1mIaxRAo1ZsJRH45fq8j4N63I/vvg==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.27.1.tgz", + "integrity": "sha512-FkEfMuiAA+utxcauRC23iw3zT/wioQjYv9eBGMVvbNqzOLa4IPHED2qIgPh/W6nrHDTH4AO47T8JvqTDV+aFWA==", "cpu": [ "arm64" ], @@ -194,9 +194,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.25.0.tgz", - "integrity": "sha512-ZRL+gexs3+ZmmWmGKEU43Bdn67kWnMeWXLFhcVv5Un8FQcx38yulHBA7XR2+KQdYIOtD0yZDWBCudmfj6lQJoA==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.27.1.tgz", + "integrity": "sha512-0KA3hHrcqdnAfyRb0bl6ifXTNoiktWR6mYKWxiCJZmUMrmR90M2Y11w5lDcjatmflo98iI0id0TztTuHcZKqRg==", "cpu": [ "x64" ], @@ -208,9 +208,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.25.0.tgz", - "integrity": "sha512-xpEIXhiP27EAylEpreCozozsxWQ2TJbOLSivGfXhU4G1TBVEYtUPi2pOZBnvGXHyOdLAUUhPnJzH3ah5cqF01g==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.27.1.tgz", + "integrity": "sha512-WOAkR+4FwxTZ5QvsSt2j1XB5Artr5eGyAInfH8G1uvL2ic1sdXuOtNDX3oj5jFswnb8Tv5r5uOFSI3e+io435A==", "cpu": [ "arm64" ], @@ -222,9 +222,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.25.0.tgz", - "integrity": "sha512-sC5FsmZGlJv5dOcURrsnIK7ngc3Kirnx3as2XU9uER+zjfyqIjdcMVgzy4cOawhsssqzoAX19qmxgJ8a14Qrqw==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.27.1.tgz", + "integrity": "sha512-9tj94xM3QCXb/tJqrJj0UQWjYcb7c+VQM4YZDctRFfgVAc/edfmZUc2f/lvoZMmenllcN+D44bMxC8nIrEq6pw==", "cpu": [ "x64" ], @@ -236,9 +236,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.25.0.tgz", - "integrity": "sha512-uD/dbLSs1BEPzg564TpRAQ/YvTnCds2XxyOndAO8nJhaQcqQGFgv/DAVko/ZHap3boCvxnzYMa3mTkV/B/3SWA==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.27.1.tgz", + "integrity": "sha512-AYyiqk5p6qH/Rfgm9WsMs559S8ICzwBTS7hu8J9vya1lqCg9Htw6U/KV+gsJ1SE4Z4IctkbIkQy24htk9nfs6A==", "cpu": [ "arm" ], @@ -250,9 +250,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.25.0.tgz", - "integrity": "sha512-ZVt/XkrDlQWegDWrwyC3l0OfAF7yeJUF4fq5RMS07YM72BlSfn2fQQ6lPyBNjt+YbczMguPiJoCfaQC2dnflpQ==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.27.1.tgz", + "integrity": "sha512-MHkwGQ96RbQTJVeV7O10gzB09Y3H1WAIUm6vMPrGRCZEsbqLHych5MlyvHHL1BXjSLB8t441eSXoepMsh8jxtg==", "cpu": [ "arm" ], @@ -264,9 +264,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.25.0.tgz", - "integrity": "sha512-qboZ+T0gHAW2kkSDPHxu7quaFaaBlynODXpBVnPxUgvWYaE84xgCKAPEYE+fSMd3Zv5PyFZR+L0tCdYCMAtG0A==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.27.1.tgz", + "integrity": "sha512-p9huy9uW0FCtjqAHRrHcBVU63xtbfBwcvjV4N4a0cy69sdvTsHLlg/pb3WqSz4eTFxnpfZ6SMTpilew53+DQ1Q==", "cpu": [ "arm64" ], @@ -278,9 +278,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.25.0.tgz", - "integrity": "sha512-ndWTSEmAaKr88dBuogGH2NZaxe7u2rDoArsejNslugHZ+r44NfWiwjzizVS1nUOHo+n1Z6qV3X60rqE/HlISgw==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.27.1.tgz", + "integrity": "sha512-1d5UxhZlVFnyF5rFWNXMrr/MHkBU32xfmFI/KPosuKhvUS7ge2T3Z3R5r3PlB/tv9fMETcvr761G35r08MK3sQ==", "cpu": [ "arm64" ], @@ -292,9 +292,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.25.0.tgz", - "integrity": "sha512-BVSQvVa2v5hKwJSy6X7W1fjDex6yZnNKy3Kx1JGimccHft6HV0THTwNtC2zawtNXKUu+S5CjXslilYdKBAadzA==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.27.1.tgz", + "integrity": "sha512-/ht989pqM1mw+6xBAExE5WlgCCT0HV4uJQmRYUUZvXAPtbnPjkZ4oevR0upyF2fPhrtgsrptMtBiD2Zax0PXzw==", "cpu": [ "ppc64" ], @@ -306,9 +306,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.25.0.tgz", - "integrity": "sha512-G4hTREQrIdeV0PE2JruzI+vXdRnaK1pg64hemHq2v5fhv8C7WjVaeXc9P5i4Q5UC06d/L+zA0mszYIKl+wY8oA==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.27.1.tgz", + "integrity": "sha512-udOKLtPNOVwSwre2v+Bmp3qYBvqkjP+wYIGic1r3XqzpiuvIxfQOt8hSxnp45eFeiHV50+ol4IpZJ2WEt4Hkog==", "cpu": [ "riscv64" ], @@ -320,9 +320,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.25.0.tgz", - "integrity": "sha512-9T/w0kQ+upxdkFL9zPVB6zy9vWW1deA3g8IauJxojN4bnz5FwSsUAD034KpXIVX5j5p/rn6XqumBMxfRkcHapQ==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.27.1.tgz", + "integrity": "sha512-eVs55EQmW92BDzlwzp1Yg5dGEP8UxXb611qe0DS2xM4WxmFPjjTyb7JSsrxRbdl91A5ZNcW4O8cQuDJ7ELYdeg==", "cpu": [ "s390x" ], @@ -334,9 +334,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.25.0.tgz", - "integrity": "sha512-ThcnU0EcMDn+J4B9LD++OgBYxZusuA7iemIIiz5yzEcFg04VZFzdFjuwPdlURmYPZw+fgVrFzj4CA64jSTG4Ig==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.27.1.tgz", + "integrity": "sha512-8/s+Qj8bGaE03YqfAbS4SI1imWVJj0NvP/828FO8qGu7nS6b0ur7n+PcM8UOU0+lzSgcO/aUk97EXMaPkegGDw==", "cpu": [ "x64" ], @@ -348,9 +348,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.25.0.tgz", - "integrity": "sha512-zx71aY2oQxGxAT1JShfhNG79PnjYhMC6voAjzpu/xmMjDnKNf6Nl/xv7YaB/9SIa9jDYf8RBPWEnjcdlhlv1rQ==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.27.1.tgz", + "integrity": "sha512-mU8t4pSlUkvdRrhP8Gl8cU46W61avh+wUWTLQd/EBm/Ny19slYYXVvB9lHpAtLT9AVaXxMvTSc9m6H1qmUDDlw==", "cpu": [ "x64" ], @@ -362,9 +362,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.25.0.tgz", - "integrity": "sha512-JT8tcjNocMs4CylWY/CxVLnv8e1lE7ff1fi6kbGocWwxDq9pj30IJ28Peb+Y8yiPNSF28oad42ApJB8oUkwGww==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.27.1.tgz", + "integrity": "sha512-AcQsa9FF6T9FrHXWXGAqJ6Kjcae2lYEDZA7wRQmK/3Bvv/0hH38tJL51CYclTY90fRf1mtKuwpC4LRcMkZuV1w==", "cpu": [ "arm64" ], @@ -376,9 +376,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.25.0.tgz", - "integrity": "sha512-dRLjLsO3dNOfSN6tjyVlG+Msm4IiZnGkuZ7G5NmpzwF9oOc582FZG05+UdfTbz5Jd4buK/wMb6UeHFhG18+OEg==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.27.1.tgz", + "integrity": "sha512-rTQbl/dhpKbOb83i8AHAQm5FTeDmoKQqiNH2F3vlp5fySgT4t36wehWoCcrax7LRCmXc1LWrj66LEnrcXK/SRA==", "cpu": [ "ia32" ], @@ -390,9 +390,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.25.0.tgz", - "integrity": "sha512-/RqrIFtLB926frMhZD0a5oDa4eFIbyNEwLLloMTEjmqfwZWXywwVVOVmwTsuyhC9HKkVEZcOOi+KV4U9wmOdlg==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.27.1.tgz", + "integrity": "sha512-zpKGR76smqVOCPeQPqmqXNhEXx+1WwHwozJWvWU6cYy5itRQyYC8TQQoWph+ikxJz5H81u6vwNB8cnYzvXV5Mw==", "cpu": [ "x64" ], @@ -574,9 +574,9 @@ } }, "node_modules/rollup": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.25.0.tgz", - "integrity": "sha512-uVbClXmR6wvx5R1M3Od4utyLUxrmOcEm3pAtMphn73Apq19PDtHpgZoEvqH2YnnaNUuvKmg2DgRd2Sqv+odyqg==", + "version": "4.27.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.27.1.tgz", + "integrity": "sha512-TgWbfXdZsMNTNCLv6/YXzPTjyA0m1mFTe3/2/C5VxA8bSYwyam8OIJiHZZUhErmNzKNcPLWec3KUIdMdXZ6+FA==", "dev": true, "license": "MIT", "dependencies": { @@ -590,24 +590,24 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.25.0", - "@rollup/rollup-android-arm64": "4.25.0", - "@rollup/rollup-darwin-arm64": "4.25.0", - "@rollup/rollup-darwin-x64": "4.25.0", - "@rollup/rollup-freebsd-arm64": "4.25.0", - "@rollup/rollup-freebsd-x64": "4.25.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.25.0", - "@rollup/rollup-linux-arm-musleabihf": "4.25.0", - "@rollup/rollup-linux-arm64-gnu": "4.25.0", - "@rollup/rollup-linux-arm64-musl": "4.25.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.25.0", - "@rollup/rollup-linux-riscv64-gnu": "4.25.0", - "@rollup/rollup-linux-s390x-gnu": "4.25.0", - "@rollup/rollup-linux-x64-gnu": "4.25.0", - "@rollup/rollup-linux-x64-musl": "4.25.0", - "@rollup/rollup-win32-arm64-msvc": "4.25.0", - "@rollup/rollup-win32-ia32-msvc": "4.25.0", - "@rollup/rollup-win32-x64-msvc": "4.25.0", + "@rollup/rollup-android-arm-eabi": "4.27.1", + "@rollup/rollup-android-arm64": "4.27.1", + "@rollup/rollup-darwin-arm64": "4.27.1", + "@rollup/rollup-darwin-x64": "4.27.1", + "@rollup/rollup-freebsd-arm64": "4.27.1", + "@rollup/rollup-freebsd-x64": "4.27.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.27.1", + "@rollup/rollup-linux-arm-musleabihf": "4.27.1", + "@rollup/rollup-linux-arm64-gnu": "4.27.1", + "@rollup/rollup-linux-arm64-musl": "4.27.1", + "@rollup/rollup-linux-powerpc64le-gnu": "4.27.1", + "@rollup/rollup-linux-riscv64-gnu": "4.27.1", + "@rollup/rollup-linux-s390x-gnu": "4.27.1", + "@rollup/rollup-linux-x64-gnu": "4.27.1", + "@rollup/rollup-linux-x64-musl": "4.27.1", + "@rollup/rollup-win32-arm64-msvc": "4.27.1", + "@rollup/rollup-win32-ia32-msvc": "4.27.1", + "@rollup/rollup-win32-x64-msvc": "4.27.1", "fsevents": "~2.3.2" } }, diff --git a/docs/docs/CPG/specs/eog.md b/docs/docs/CPG/specs/eog.md index 488189cde84..5c3a662a4d8 100644 --- a/docs/docs/CPG/specs/eog.md +++ b/docs/docs/CPG/specs/eog.md @@ -860,8 +860,97 @@ flowchart LR ``` +## TypeExpression +The expression itself is connected to the outer EOG. +Interesting fields: / +Scheme: +```mermaid +flowchart LR + classDef outer fill:#fff,stroke:#ddd,stroke-dasharray:5 5; + prev:::outer --EOG--> parent["TypeExpression"] + parent --EOG--> next:::outer +``` - +## LookupScopeStatement +The statement itself is connected to the outer EOG. + +Interesting fields: / + +Scheme: +```mermaid +flowchart LR + classDef outer fill:#fff,stroke:#ddd,stroke-dasharray:5 5; + prev:::outer --EOG--> parent["LookupScopeStatement"] + parent --EOG--> next:::outer +``` + +## EmptyStatement +The statement itself is connected to the outer EOG. + +Interesting fields: / + +Scheme: +```mermaid +flowchart LR + classDef outer fill:#fff,stroke:#ddd,stroke-dasharray:5 5; + prev:::outer --EOG--> parent["EmptyStatement"] + parent --EOG--> next:::outer +``` + +## Literal +The statement itself is connected to the outer EOG. + +Interesting fields: / + +Scheme: +```mermaid +flowchart LR + classDef outer fill:#fff,stroke:#ddd,stroke-dasharray:5 5; + prev:::outer --EOG--> parent["Literal"] + parent --EOG--> next:::outer +``` + +## DefaultStatement +The statement itself is connected to the outer EOG. + +Interesting fields: / + +Scheme: +```mermaid +flowchart LR + classDef outer fill:#fff,stroke:#ddd,stroke-dasharray:5 5; + prev:::outer --EOG--> parent["DefaultStatement"] + parent --EOG--> next:::outer +``` + +## TypeIdExpression +The statement itself is connected to the outer EOG. + +Interesting fields: / + +Scheme: +```mermaid +flowchart LR + classDef outer fill:#fff,stroke:#ddd,stroke-dasharray:5 5; + prev:::outer --EOG--> parent["TypeIdExpression"] + parent --EOG--> next:::outer +``` + +## Reference +The statement itself is connected to the outer EOG. + +Interesting fields: / + +Scheme: +```mermaid +flowchart LR + classDef outer fill:#fff,stroke:#ddd,stroke-dasharray:5 5; + prev:::outer --EOG--> parent["Reference"] + parent --EOG--> next:::outer +``` +## IncludeDeclaration +The `IncludeDeclaration` is not connected to the EOG. +We continue with the next statement.