Util

object Util

Types

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

fun addDFGEdgesForMutuallyExclusiveBranchingExpression(n: Node, branchingExp: Node?, branchingDeclaration: Node?)

Connects the node n with the node branchingExp if present or with the node branchingDecl. The assumption is that only branchingExp or branchingDecl are present, e.g. C++.

Link copied to clipboard

Establish data-flow from a CallExpression arguments to the target FunctionDeclaration parameters. Additionally, if the call is a MemberCallExpression, it establishes a data-flow from the MemberCallExpression.base towards the MethodDeclaration.receiver.

Link copied to clipboard
fun containsOnOuterLevel(input: String, marker: Char): Boolean
Link copied to clipboard
inline fun debugWithFileLocation(node: Node?, log: Logger, format: String?, vararg arguments: Any?)

Logs a debug message with the specified file location. This is intentionally inlined, so that the Logger will use the location of the callee of this function, rather than the Util class.

Link copied to clipboard

Inverse operation of attachCallParameters

Link copied to clipboard
fun eogConnect(q: Util.Quantifier = Quantifier.ALL, cn: Util.Connect = Connect.SUBTREE, en: Util.Edge, n: Node?, cr: Util.Connect = Connect.SUBTREE, predicate: (EvaluationOrder) -> Boolean? = null, refs: List<Node?>): Boolean

Checks if the Node n connects to the nodes in refs over the CPGS EOG graph edges that depict the evaluation order. The parameter q defines if all edges of interest to node must connect to an edge in refs or one is enough, cn and cr define whether the passed AST nodes themselves are used to search the connections or the EOG Border nodes in the AST subnode. Finally, en defines whether the EOG edges go * from n to r in refs or the inverse.

Link copied to clipboard
inline fun errorWithFileLocation(node: Node?, log: Logger, format: String?, vararg arguments: Any?)
inline fun <AstNode> errorWithFileLocation(lang: LanguageFrontend<AstNode, *>, astNode: AstNode, log: Logger, format: String?, vararg arguments: Any?)

Logs an error with the specified file location. This is intentionally inlined, so that the Logger will use the location of the callee of this function, rather than the Util class.

Link copied to clipboard

This function returns the set of adjacent DFG nodes that is contained in the nodes subgraph.

Link copied to clipboard

Removes pairs of parentheses that do not provide any further separation. E.g. "(foo)" results in "foo" and "(((foo))((bar)))" in "(foo)(bar)", whereas "(foo)(bar)" stays the same.

Link copied to clipboard

Split a String into multiple parts by using one or more delimiter characters. Any delimiters that are surrounded by matching opening and closing brackets are skipped. E.g. "a,(b,c)" will result in a list containing "a" and "(b,c)" when splitting on commas. Empty parts are ignored, so when splitting "a,,,,(b,c)", the same result is returned as in the previous example.

Link copied to clipboard
fun subnodesOfCode(node: Node?, searchCode: String): List<Node>

Filters the nodes in the AST subtree at root node for Nodes with the specified code.

Link copied to clipboard
inline fun warnWithFileLocation(node: Node, log: Logger, format: String?, vararg arguments: Any?)
inline fun warnWithFileLocation(location: PhysicalLocation?, log: Logger, format: String?, vararg arguments: Any?)
inline fun <AstNode> warnWithFileLocation(lang: LanguageFrontend<AstNode, *>, astNode: AstNode, log: Logger, format: String?, vararg arguments: Any?)

Logs a warning with the specified file location. This is intentionally inlined, so that the Logger will use the location of the callee of this function, rather than the Util class.