Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
sealed class CastResult

CastResult is the result of the function Language.tryCast and describes whether a cast of one type into another is successful according to the logic of the Language.

Link copied to clipboard

A compilation database contains necessary information about the include paths and possible compiler flags that should be used for an individual source file. It follows the JSON Compilation Database Format Specification (see https://clang.llvm.org/docs/JSONCompilationDatabase.html).

Link copied to clipboard
typealias ComponentName = String
Link copied to clipboard
data object DirectMatch : CastResult
Link copied to clipboard
Link copied to clipboard

A Handler is an abstract base class for a class that translates AST nodes from a raw ast type, usually supplied by a language parser into our generic CPG nodes.

Link copied to clipboard
fun interface HandlerInterface<S, T>

This functional interface specifies how a handler class should translate raw AST nodes into CPG nodes.

Link copied to clipboard

A language trait, that specifies that this language has an "anonymous" identifier, used for unused parameters or suppressed assignments.

Link copied to clipboard

A common super-class for all language traits that arise because they are an ambiguity of a function call, e.g., function-style casts. This means that we cannot differentiate between a CallExpression and other expressions during the frontend and we need to invoke the ResolveCallExpressionAmbiguityPass to resolve this.

Link copied to clipboard

A language trait that specifies if the language has the concept of "classes". The alternative is to use structs. Note that some languages can have both and that in some languages structs and classes are essentially the same. This is mostly used to determine if an inferred record declaration can be a class or must be a struct.

Link copied to clipboard

A language trait that specifies, that this language has support for default arguments, e.g. in functions.

Link copied to clipboard

A language trait, that specifies that this language has "elaborated type specifiers". If so, we should consider them when parsing the types.

Link copied to clipboard

A language trait, that specifies that this language treats functions "first-class citizens", meaning they can be assigned to variables and passed as arguments to other functions.

Link copied to clipboard

A language trait that specifies that this language allowed overloading functions, meaning that multiple functions can share the same name with different parameters.

Link copied to clipboard

A language trait that specifies if the language supports function pointers.

Link copied to clipboard

A language trait, that specifies that the language has so-called functional style casts, meaning that they look like regular call expressions. Since we can therefore not distinguish between a CallExpression and a CastExpression, we need to employ an additional pass (ResolveCallExpressionAmbiguityPass) after the initial language frontends are done.

Link copied to clipboard

A language trait, that specifies that the language has functional style (object) construction, meaning that constructor calls look like regular call expressions (usually meaning that the language has no dedicated new keyword).

Link copied to clipboard

A language trait, that specifies that this language has support for templates or generics.

Link copied to clipboard

A language trait, that specifies that this language has global variables directly in the GlobalScope, i.e., not within a namespace, but directly contained in a TranslationUnitDeclaration.

Link copied to clipboard

A language trait, that specifies that this language has support for implicit receiver, e.g., that one can omit references to a base such as this.

Link copied to clipboard

A language trait that specifies that this language allows overloading of operators.

Link copied to clipboard

A language trait, that specifies that this language has certain qualifiers. If so, we should consider them when parsing the types.

Link copied to clipboard

A language trait, that specifies that this language has binary operators that will short-circuit evaluation if the logical result is already known: '&&', '||' in Java or 'and','or' in Python

Link copied to clipboard

A language trait that specifies if the language has the concept of "structs". The alternative is to use classes. Note that some languages can have both and that in some languages structs and classes are essentially the same. This is mostly used to determine if an inferred record declaration can be a struct or must be a class.

Link copied to clipboard

A language trait, that specifies that this language has support for superclasses. If so, we should consider the specified superclass keyword to resolve calls etc.

Link copied to clipboard

A language trait, that specifies that this language has support for templates or generics.

Link copied to clipboard

A language trait, that specifies that this language has specifiers which let us conclude that we do not know the type. If so, we should consider them when parsing the types.

Link copied to clipboard
data class ImplicitCast(var depthDistance: Int) : CastResult
Link copied to clipboard
abstract class Language<T : LanguageFrontend<*, *>> : Node

Represents a programming language. When creating new languages in the CPG, one must derive custom class from this and override the necessary fields and methods.

Link copied to clipboard

The main task of the language frontend is to translate the programming language-specific files to the common CPG nodes. It further fills the scopeManager. The language frontend must not be used after having processed the files, i.e., it won't be available in passes.

Link copied to clipboard
interface LanguageTrait

A language trait is a feature or trait that is common to a group of programming languages. Any Language that supports them should implement the desired trait interface. Examples could be the support of pointers, support for templates or generics.

Link copied to clipboard

This class is a piece of legacy code that seems to offer a functionality to register certain listeners that get executed when raw AST nodes are processed into certain nodes (specified in interestingStatements).

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class SupportsParallelParsing(val supported: Boolean = true)

Determines if the LanguageFrontend can parse multiple files in parallel. Defaults to true.

Link copied to clipboard

A generic exception that can be thrown from a LanguageFrontend, if it reaches a state where it cannot continue translating source code into the graph.

Properties

Link copied to clipboard

Checks whether the name for a function (as CharSequence) is a known operator name.

Functions

Link copied to clipboard
infix inline fun <T : HasOverloadedOperation> KClass<T>.of(operatorCode: String): Pair<KClass<T>, String>

Creates a Pair of class and operator code used in HasOperatorOverloading.overloadedOperatorNames.