Package io.shiftleft.proto.cpg
Enum Cpg.CpgStruct.Node.NodeType
- java.lang.Object
-
- java.lang.Enum<Cpg.CpgStruct.Node.NodeType>
-
- io.shiftleft.proto.cpg.Cpg.CpgStruct.Node.NodeType
-
- All Implemented Interfaces:
com.google.protobuf.Internal.EnumLite
,com.google.protobuf.ProtocolMessageEnum
,java.io.Serializable
,java.lang.Comparable<Cpg.CpgStruct.Node.NodeType>
- Enclosing class:
- Cpg.CpgStruct.Node
public static enum Cpg.CpgStruct.Node.NodeType extends java.lang.Enum<Cpg.CpgStruct.Node.NodeType> implements com.google.protobuf.ProtocolMessageEnum
Logical node type.
Protobuf enumcpg.CpgStruct.Node.NodeType
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BINDING
`BINDING` nodes represent name-signature pairs that can be resolved at a type declaration (`TYPE_DECL`).BLOCK
This node represents a compound statement.CALL
A (function/method/procedure) call.CLOSURE_BINDING
Represents the binding of a LOCAL or METHOD_PARAMETER_IN into the closure of a methodCOMMENT
A source code commentCONFIG_FILE
This node type represent a configuration file, where `NAME` is the name of the file and `content` is its content.CONTROL_STRUCTURE
This node represents a control structure as introduced by control structure statements as well as conditional and unconditional jumps.DEPENDENCY
This node represents a dependencyFIELD_IDENTIFIER
This node represents the field accessed in a field access, e.g., in `a.b`, it represents `b`.FILE
File nodes represent source files or a shared objects from which the CPG was generated.FINDING
Finding nodes may be used to store analysis results in the graph that are to be exposed to an end-user, e.g., information about potential vulnerabilities or dangerous programming practices.IDENTIFIER
This node represents an identifier as used when referring to a variable by name.JUMP_TARGET
A jump target is any location in the code that has been specifically marked as the target of a jump, e.g., via a label.KEY_VALUE_PAIR
This node represents a key value pair, where both the key and the value are strings.LITERAL
This node represents a literal such as an integer or string constant.LOCAL
This node represents a local variable.LOCATION
A location node summarizes a source code location.MEMBER
This node represents a type member of a class, struct or union, e.g., for the type declaration `class Foo{ int i ; }`, it represents the declaration of the variable `i`.META_DATA
This node contains the CPG meta data.METHOD
Programming languages offer many closely-related concepts for describing blocks of code that can be executed with input parameters and return output parameters, possibly causing side effects.METHOD_PARAMETER_IN
This node represents a formal input parameter.METHOD_PARAMETER_OUT
This node represents a formal output parameter.METHOD_REF
This node represents a reference to a method/function/procedure as it appears when a method is passed as an argument in a call.METHOD_RETURN
This node represents an (unnamed) formal method return parameter.MODIFIER
This field represents a (language-dependent) modifier such as `static`, `private` or `public`.NAMESPACE
This node represents a namespace.NAMESPACE_BLOCK
A reference to a namespace.RETURN
This node represents a return instruction, e.g., `return x`.TAG
This node represents a tag.TAG_NODE_PAIR
This node contains an arbitrary node and an associated tag node.TYPE
This node represents a type instance, that is, a concrete instantiation of a type declaration.TYPE_ARGUMENT
An (actual) type argument as used to instantiate a parametrized type, in the same way an (actual) arguments provides concrete values for a parameter at method call sites.TYPE_DECL
This node represents a type declaration as for example given by a class-, struct-, or union declaration.TYPE_PARAMETER
This node represents a formal type parameter, that is, the type parameter as given in a type-parametrized method or type declaration.TYPE_REF
Reference to a type/classUNKNOWN
Any AST node that the frontend would like to include in the AST but for which no suitable AST node is specified in the CPG specification may be included using a node of type `UNKNOWN`.UNKNOWN_NODE_TYPE
UNKNOWN_NODE_TYPE = 0;
UNRECOGNIZED
-
Field Summary
Fields Modifier and Type Field Description static int
BINDING_VALUE
`BINDING` nodes represent name-signature pairs that can be resolved at a type declaration (`TYPE_DECL`).static int
BLOCK_VALUE
This node represents a compound statement.static int
CALL_VALUE
A (function/method/procedure) call.static int
CLOSURE_BINDING_VALUE
Represents the binding of a LOCAL or METHOD_PARAMETER_IN into the closure of a methodstatic int
COMMENT_VALUE
A source code commentstatic int
CONFIG_FILE_VALUE
This node type represent a configuration file, where `NAME` is the name of the file and `content` is its content.static int
CONTROL_STRUCTURE_VALUE
This node represents a control structure as introduced by control structure statements as well as conditional and unconditional jumps.static int
DEPENDENCY_VALUE
This node represents a dependencystatic int
FIELD_IDENTIFIER_VALUE
This node represents the field accessed in a field access, e.g., in `a.b`, it represents `b`.static int
FILE_VALUE
File nodes represent source files or a shared objects from which the CPG was generated.static int
FINDING_VALUE
Finding nodes may be used to store analysis results in the graph that are to be exposed to an end-user, e.g., information about potential vulnerabilities or dangerous programming practices.static int
IDENTIFIER_VALUE
This node represents an identifier as used when referring to a variable by name.static int
JUMP_TARGET_VALUE
A jump target is any location in the code that has been specifically marked as the target of a jump, e.g., via a label.static int
KEY_VALUE_PAIR_VALUE
This node represents a key value pair, where both the key and the value are strings.static int
LITERAL_VALUE
This node represents a literal such as an integer or string constant.static int
LOCAL_VALUE
This node represents a local variable.static int
LOCATION_VALUE
A location node summarizes a source code location.static int
MEMBER_VALUE
This node represents a type member of a class, struct or union, e.g., for the type declaration `class Foo{ int i ; }`, it represents the declaration of the variable `i`.static int
META_DATA_VALUE
This node contains the CPG meta data.static int
METHOD_PARAMETER_IN_VALUE
This node represents a formal input parameter.static int
METHOD_PARAMETER_OUT_VALUE
This node represents a formal output parameter.static int
METHOD_REF_VALUE
This node represents a reference to a method/function/procedure as it appears when a method is passed as an argument in a call.static int
METHOD_RETURN_VALUE
This node represents an (unnamed) formal method return parameter.static int
METHOD_VALUE
Programming languages offer many closely-related concepts for describing blocks of code that can be executed with input parameters and return output parameters, possibly causing side effects.static int
MODIFIER_VALUE
This field represents a (language-dependent) modifier such as `static`, `private` or `public`.static int
NAMESPACE_BLOCK_VALUE
A reference to a namespace.static int
NAMESPACE_VALUE
This node represents a namespace.static int
RETURN_VALUE
This node represents a return instruction, e.g., `return x`.static int
TAG_NODE_PAIR_VALUE
This node contains an arbitrary node and an associated tag node.static int
TAG_VALUE
This node represents a tag.static int
TYPE_ARGUMENT_VALUE
An (actual) type argument as used to instantiate a parametrized type, in the same way an (actual) arguments provides concrete values for a parameter at method call sites.static int
TYPE_DECL_VALUE
This node represents a type declaration as for example given by a class-, struct-, or union declaration.static int
TYPE_PARAMETER_VALUE
This node represents a formal type parameter, that is, the type parameter as given in a type-parametrized method or type declaration.static int
TYPE_REF_VALUE
Reference to a type/classstatic int
TYPE_VALUE
This node represents a type instance, that is, a concrete instantiation of a type declaration.static int
UNKNOWN_NODE_TYPE_VALUE
UNKNOWN_NODE_TYPE = 0;
static int
UNKNOWN_VALUE
Any AST node that the frontend would like to include in the AST but for which no suitable AST node is specified in the CPG specification may be included using a node of type `UNKNOWN`.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Cpg.CpgStruct.Node.NodeType
forNumber(int value)
static com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor()
com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType()
int
getNumber()
com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor()
static com.google.protobuf.Internal.EnumLiteMap<Cpg.CpgStruct.Node.NodeType>
internalGetValueMap()
static Cpg.CpgStruct.Node.NodeType
valueOf(int value)
Deprecated.static Cpg.CpgStruct.Node.NodeType
valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc)
Returns the enum constant of this type with the specified name.static Cpg.CpgStruct.Node.NodeType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static Cpg.CpgStruct.Node.NodeType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
UNKNOWN_NODE_TYPE
public static final Cpg.CpgStruct.Node.NodeType UNKNOWN_NODE_TYPE
UNKNOWN_NODE_TYPE = 0;
-
METHOD
public static final Cpg.CpgStruct.Node.NodeType METHOD
Programming languages offer many closely-related concepts for describing blocks of code that can be executed with input parameters and return output parameters, possibly causing side effects. In the CPG specification, we refer to all of these concepts (procedures, functions, methods, etc.) as methods. A single METHOD node must exist for each method found in the source program. The `FULL_NAME` field specifies the method's fully-qualified name, including information about the namespace it is contained in if applicable, the name field is the function's short name. The field `IS_EXTERNAL` indicates whether it was possible to identify a method body for the method. This is true for methods that are defined in the source program, and false for methods that are dynamically linked to the program, that is, methods that exist in an external dependency. Line and column number information is specified in the optional fields `LINE_NUMBER`, `COLUMN_NUMBER`, `LINE_NUMBER_END`, and `COLUMN_NUMBER_END` and the name of the source file is specified in `FILENAME`. An optional hash value MAY be calculated over the function contents and included in the `HASH` field. Finally, the fully qualified name of the program constructs that the method is immediately contained in is stored in the `AST_PARENT_FULL_NAME` field and its type is indicated in the `AST_PARENT_TYPE` field to be one of `METHOD`, `TYPE_DECL` or `NAMESPACE_BLOCK`.
METHOD = 1;
-
METHOD_RETURN
public static final Cpg.CpgStruct.Node.NodeType METHOD_RETURN
This node represents an (unnamed) formal method return parameter. It carries its fully qualified type name in `TYPE_FULL_NAME`. The `CODE` field MAY be set freely, e.g., to the constant `RET`, however, subsequent layer creators MUST NOT depend on this value.
METHOD_RETURN = 3;
-
LITERAL
public static final Cpg.CpgStruct.Node.NodeType LITERAL
This node represents a literal such as an integer or string constant. Literals are symbols included in the code in verbatim form and which are immutable. The `TYPE_FULL_NAME` field stores the literal's fully-qualified type name, e.g., `java.lang.Integer`.
LITERAL = 8;
-
MEMBER
public static final Cpg.CpgStruct.Node.NodeType MEMBER
This node represents a type member of a class, struct or union, e.g., for the type declaration `class Foo{ int i ; }`, it represents the declaration of the variable `i`.
MEMBER = 9;
-
CALL
public static final Cpg.CpgStruct.Node.NodeType CALL
A (function/method/procedure) call. The `METHOD_FULL_NAME` property is the name of the invoked method (the callee) while the `TYPE_FULL_NAME` is its return type, and therefore, the return type of the call when viewing it as an expression. For languages like Javascript, it is common that we may know the (short-) name of the invoked method, but we do not know at compile time which method will actually be invoked, e.g., because it depends on a dynamic import. In this case, we leave `METHOD_FULL_NAME` blank but at least fill out `NAME`, which contains the method's (short-) name and `SIGNATURE`, which contains any information we may have about the types of arguments and return value.
CALL = 15;
-
LOCAL
public static final Cpg.CpgStruct.Node.NodeType LOCAL
This node represents a local variable. Its fully qualified type name is stored in the `TYPE_FULL_NAME` field and its name in the `NAME` field. The `CODE` field contains the entire local variable declaration without initialization, e.g., for `int x = 10;`, it contains `int x`.
LOCAL = 23;
-
TAG
public static final Cpg.CpgStruct.Node.NodeType TAG
This node represents a tag.
TAG = 24;
-
LOCATION
public static final Cpg.CpgStruct.Node.NodeType LOCATION
A location node summarizes a source code location.
LOCATION = 25;
-
IDENTIFIER
public static final Cpg.CpgStruct.Node.NodeType IDENTIFIER
This node represents an identifier as used when referring to a variable by name. It holds the identifier's name in the `NAME` field and its fully-qualified type name in `TYPE_FULL_NAME`.
IDENTIFIER = 27;
-
RETURN
public static final Cpg.CpgStruct.Node.NodeType RETURN
This node represents a return instruction, e.g., `return x`. Note that it does NOT represent a formal return parameter as formal return parameters are represented via `METHOD_RETURN` nodes.
RETURN = 30;
-
BLOCK
public static final Cpg.CpgStruct.Node.NodeType BLOCK
This node represents a compound statement. Compound statements are used in many languages to allow grouping a sequence of statements. For example, in C and Java, compound statements are statements enclosed by curly braces. Function/Method bodies are compound statements. We do not use the term "compound statement" because "statement" would imply that the block does not yield a value upon evaluation, that is, that it is not an expression. This is true in languages such as C and Java, but not for languages such as Scala where the value of the block is given by that of the last expression it contains. In fact, the Scala grammar uses the term "BlockExpr" (short for "block expression") to describe what in the CPG we call "Block".
BLOCK = 31;
-
METHOD_PARAMETER_OUT
public static final Cpg.CpgStruct.Node.NodeType METHOD_PARAMETER_OUT
This node represents a formal output parameter. Corresponding output parameters for input parameters MUST NOT be created by the frontend as they are automatically created upon first loading the CPG.
METHOD_PARAMETER_OUT = 33;
-
METHOD_PARAMETER_IN
public static final Cpg.CpgStruct.Node.NodeType METHOD_PARAMETER_IN
This node represents a formal input parameter. The field `NAME` contains its name, while the field `TYPE_FULL_NAME` contains the fully qualified type name.
METHOD_PARAMETER_IN = 34;
-
DEPENDENCY
public static final Cpg.CpgStruct.Node.NodeType DEPENDENCY
This node represents a dependency
DEPENDENCY = 35;
-
FILE
public static final Cpg.CpgStruct.Node.NodeType FILE
File nodes represent source files or a shared objects from which the CPG was generated. File nodes serve as indices, that is, they allow looking up all elements of the code by file. For each file, the graph MUST contain exactly one File node. As file nodes are root nodes of abstract syntax tress, they are AstNodes and their order field is set to 0. This is because they have no sibling nodes, not because they are the first node of the AST. Each CPG MUST contain a special file node with name set to `<unknown>`. This node is a placeholder used in cases where a file cannot be determined at compile time. As an example, consider external library functions. As their code is not available on CPG construction, the file name is unknown. File nodes MUST NOT be created by the language frontend. Instead, the language frontend is assumed to fill out the `FILENAME` field wherever possible, allowing File nodes to be created automatically upon first loading the CPG.
FILE = 38;
-
META_DATA
public static final Cpg.CpgStruct.Node.NodeType META_DATA
This node contains the CPG meta data. Exactly one node of this type MUST exist per CPG. The `HASH` property MAY contain a hash value calculated over the source files this CPG was generated from. The `VERSION` MUST be set to the version of the specification ("1.1"). The language field indicates which language frontend was used to generate the CPG and the list property `OVERLAYS` specifies which overlays have been applied to the CPG.
META_DATA = 39;
-
NAMESPACE
public static final Cpg.CpgStruct.Node.NodeType NAMESPACE
This node represents a namespace. Similar to FILE nodes, NAMESPACE nodes serve as indices that allow all definitions inside a namespace to be obtained by following outgoing edges from a NAMESPACE node. NAMESPACE nodes MUST NOT be created by language frontends. Instead, they are generated from NAMESPACE_BLOCK nodes automatically upon first loading of the CPG.
NAMESPACE = 40;
-
NAMESPACE_BLOCK
public static final Cpg.CpgStruct.Node.NodeType NAMESPACE_BLOCK
A reference to a namespace. We borrow the concept of a "namespace block" from C++, that is, a namespace block is a block of code that has been placed in the same namespace by a programmer. This block may be introduced via a `package` statement in Java or a `namespace{ }` statement in C++. The `FULL_NAME` field contains the namespace name in a human-readable format. The name should be given in dot-separated form where a dot indicates the the right hand side is a sub namespace of the left hand side, e.g., `foo.bar` denotes the namespace `bar` contained in the namespace `foo`. The `NAME` field contains the name of the namespace without the names of its parent namespaces, e.g., for the namespace `foo.woo.bar`, the `NAME` field is `bar`.
NAMESPACE_BLOCK = 41;
-
UNKNOWN
public static final Cpg.CpgStruct.Node.NodeType UNKNOWN
Any AST node that the frontend would like to include in the AST but for which no suitable AST node is specified in the CPG specification may be included using a node of type `UNKNOWN`.
UNKNOWN = 44;
-
TYPE
public static final Cpg.CpgStruct.Node.NodeType TYPE
This node represents a type instance, that is, a concrete instantiation of a type declaration.
TYPE = 45;
-
TYPE_DECL
public static final Cpg.CpgStruct.Node.NodeType TYPE_DECL
This node represents a type declaration as for example given by a class-, struct-, or union declaration. In contrast to a `TYPE` node, this node does not represent a concrete instantiation of a type, e.g., for the parametrized type `List[T]`, it represents `List[T]`, but not `List[Integer]` where `Integer` is a concrete type. The language frontend MUST create type declarations for all types declared in the source program and MAY provide type declarations for types that are not declared but referenced by the source program. If a declaration is present in the source program, the field `IS_EXTERNAL` is set to `false`. Otherwise, it is set to `true`. The `FULL_NAME` field specifies the type's fully-qualified name, including information about the namespace it is contained in if applicable, the name field is the type's short name. Line and column number information is specified in the optional fields `LINE_NUMBER`, `COLUMN_NUMBER`, `LINE_NUMBER_END`, and `COLUMN_NUMBER_END` and the name of the source file is specified in `FILENAME`. Base types can be specified via the `INHERITS_FROM_TYPE_FULL_NAME` list, where each entry contains the fully-qualified name of a base type. If the type is known to be an alias of another type (as for example introduced via the C `typedef` statement), the name of the alias is stored in `ALIAS_TYPE_FULL_NAME`. Finally, the fully qualified name of the program constructs that the type declaration is immediately contained in is stored in the `AST_PARENT_FULL_NAME` field and its type is indicated in the `AST_PARENT_TYPE` field to be one of `METHOD`, `TYPE_DECL` or `NAMESPACE_BLOCK`.
TYPE_DECL = 46;
-
TYPE_PARAMETER
public static final Cpg.CpgStruct.Node.NodeType TYPE_PARAMETER
This node represents a formal type parameter, that is, the type parameter as given in a type-parametrized method or type declaration. Examples for languages that support type parameters are Java (via Generics) and C++ (via templates). Apart from the standard fields of AST nodes, the type parameter carries only a `NAME` field that holds the parameters name.
TYPE_PARAMETER = 47;
-
TYPE_ARGUMENT
public static final Cpg.CpgStruct.Node.NodeType TYPE_ARGUMENT
An (actual) type argument as used to instantiate a parametrized type, in the same way an (actual) arguments provides concrete values for a parameter at method call sites. As it true for arguments, the method is not expected to interpret the type argument. It MUST however store its code in the `CODE` field.
TYPE_ARGUMENT = 48;
-
CONFIG_FILE
public static final Cpg.CpgStruct.Node.NodeType CONFIG_FILE
This node type represent a configuration file, where `NAME` is the name of the file and `content` is its content. The exact representation of the name is left undefined and can be chosen as required by consumers of the corresponding configuration files.
CONFIG_FILE = 50;
-
BINDING
public static final Cpg.CpgStruct.Node.NodeType BINDING
`BINDING` nodes represent name-signature pairs that can be resolved at a type declaration (`TYPE_DECL`). They are connected to `TYPE_DECL` nodes via incoming `BINDS` edges and to the methods they resolve to via outgoing `REF` edges.
BINDING = 146;
-
TAG_NODE_PAIR
public static final Cpg.CpgStruct.Node.NodeType TAG_NODE_PAIR
This node contains an arbitrary node and an associated tag node.
TAG_NODE_PAIR = 208;
-
FINDING
public static final Cpg.CpgStruct.Node.NodeType FINDING
Finding nodes may be used to store analysis results in the graph that are to be exposed to an end-user, e.g., information about potential vulnerabilities or dangerous programming practices. A Finding node may contain an abitrary list of key value pairs that characterize the finding, as well as a list of nodes that serve as evidence for the finding.
FINDING = 214;
-
KEY_VALUE_PAIR
public static final Cpg.CpgStruct.Node.NodeType KEY_VALUE_PAIR
This node represents a key value pair, where both the key and the value are strings.
KEY_VALUE_PAIR = 217;
-
MODIFIER
public static final Cpg.CpgStruct.Node.NodeType MODIFIER
This field represents a (language-dependent) modifier such as `static`, `private` or `public`. Unlike most other AST nodes, it is NOT an expression, that is, it cannot be evaluated and cannot be passed as an argument in function calls.
MODIFIER = 300;
-
METHOD_REF
public static final Cpg.CpgStruct.Node.NodeType METHOD_REF
This node represents a reference to a method/function/procedure as it appears when a method is passed as an argument in a call. The `METHOD_FULL_NAME` field holds the fully-qualified name of the referenced method and the `TYPE_FULL_NAME` holds its fully-qualified type name.
METHOD_REF = 333;
-
CLOSURE_BINDING
public static final Cpg.CpgStruct.Node.NodeType CLOSURE_BINDING
Represents the binding of a LOCAL or METHOD_PARAMETER_IN into the closure of a method
CLOSURE_BINDING = 334;
-
TYPE_REF
public static final Cpg.CpgStruct.Node.NodeType TYPE_REF
Reference to a type/class
TYPE_REF = 335;
-
CONTROL_STRUCTURE
public static final Cpg.CpgStruct.Node.NodeType CONTROL_STRUCTURE
This node represents a control structure as introduced by control structure statements as well as conditional and unconditional jumps. Its type is stored in the `CONTROL_STRUCTURE_TYPE` field to be one of several pre-defined types. These types are used in the construction of the control flow layer, making it possible to generate the control flow layer from the abstract syntax tree layer automatically. In addition to the `CONTROL_STRUCTURE_TYPE` field, the `PARSER_TYPE_NAME` field MAY be used by frontends to store the name of the control structure as emitted by the parser or disassembler, however, the value of this field is not relevant for construction of the control flow layer.
CONTROL_STRUCTURE = 339;
-
JUMP_TARGET
public static final Cpg.CpgStruct.Node.NodeType JUMP_TARGET
A jump target is any location in the code that has been specifically marked as the target of a jump, e.g., via a label. The `NAME` field holds the name of the label while the `PARSER_TYPE_NAME` field holds the name of language construct that this jump target is created from, e.g., "Label".
JUMP_TARGET = 340;
-
COMMENT
public static final Cpg.CpgStruct.Node.NodeType COMMENT
A source code comment
COMMENT = 511;
-
FIELD_IDENTIFIER
public static final Cpg.CpgStruct.Node.NodeType FIELD_IDENTIFIER
This node represents the field accessed in a field access, e.g., in `a.b`, it represents `b`. The field name as it occurs in the code is stored in the `CODE` field. This may mean that the `CODE` field holds an expression. The `CANONICAL_NAME` field MAY contain the same value is the `CODE` field but SHOULD contain the normalized name that results from evaluating `CODE` as an expression if such an evaluation is possible for the language frontend. The objective is to store an identifier in `CANONICAL_NAME` that is the same for two nodes iff they refer to the same field, regardless of whether they use the same expression to reference it.
FIELD_IDENTIFIER = 2001081;
-
UNRECOGNIZED
public static final Cpg.CpgStruct.Node.NodeType UNRECOGNIZED
-
-
Field Detail
-
UNKNOWN_NODE_TYPE_VALUE
public static final int UNKNOWN_NODE_TYPE_VALUE
UNKNOWN_NODE_TYPE = 0;
- See Also:
- Constant Field Values
-
METHOD_VALUE
public static final int METHOD_VALUE
Programming languages offer many closely-related concepts for describing blocks of code that can be executed with input parameters and return output parameters, possibly causing side effects. In the CPG specification, we refer to all of these concepts (procedures, functions, methods, etc.) as methods. A single METHOD node must exist for each method found in the source program. The `FULL_NAME` field specifies the method's fully-qualified name, including information about the namespace it is contained in if applicable, the name field is the function's short name. The field `IS_EXTERNAL` indicates whether it was possible to identify a method body for the method. This is true for methods that are defined in the source program, and false for methods that are dynamically linked to the program, that is, methods that exist in an external dependency. Line and column number information is specified in the optional fields `LINE_NUMBER`, `COLUMN_NUMBER`, `LINE_NUMBER_END`, and `COLUMN_NUMBER_END` and the name of the source file is specified in `FILENAME`. An optional hash value MAY be calculated over the function contents and included in the `HASH` field. Finally, the fully qualified name of the program constructs that the method is immediately contained in is stored in the `AST_PARENT_FULL_NAME` field and its type is indicated in the `AST_PARENT_TYPE` field to be one of `METHOD`, `TYPE_DECL` or `NAMESPACE_BLOCK`.
METHOD = 1;
- See Also:
- Constant Field Values
-
METHOD_RETURN_VALUE
public static final int METHOD_RETURN_VALUE
This node represents an (unnamed) formal method return parameter. It carries its fully qualified type name in `TYPE_FULL_NAME`. The `CODE` field MAY be set freely, e.g., to the constant `RET`, however, subsequent layer creators MUST NOT depend on this value.
METHOD_RETURN = 3;
- See Also:
- Constant Field Values
-
LITERAL_VALUE
public static final int LITERAL_VALUE
This node represents a literal such as an integer or string constant. Literals are symbols included in the code in verbatim form and which are immutable. The `TYPE_FULL_NAME` field stores the literal's fully-qualified type name, e.g., `java.lang.Integer`.
LITERAL = 8;
- See Also:
- Constant Field Values
-
MEMBER_VALUE
public static final int MEMBER_VALUE
This node represents a type member of a class, struct or union, e.g., for the type declaration `class Foo{ int i ; }`, it represents the declaration of the variable `i`.
MEMBER = 9;
- See Also:
- Constant Field Values
-
CALL_VALUE
public static final int CALL_VALUE
A (function/method/procedure) call. The `METHOD_FULL_NAME` property is the name of the invoked method (the callee) while the `TYPE_FULL_NAME` is its return type, and therefore, the return type of the call when viewing it as an expression. For languages like Javascript, it is common that we may know the (short-) name of the invoked method, but we do not know at compile time which method will actually be invoked, e.g., because it depends on a dynamic import. In this case, we leave `METHOD_FULL_NAME` blank but at least fill out `NAME`, which contains the method's (short-) name and `SIGNATURE`, which contains any information we may have about the types of arguments and return value.
CALL = 15;
- See Also:
- Constant Field Values
-
LOCAL_VALUE
public static final int LOCAL_VALUE
This node represents a local variable. Its fully qualified type name is stored in the `TYPE_FULL_NAME` field and its name in the `NAME` field. The `CODE` field contains the entire local variable declaration without initialization, e.g., for `int x = 10;`, it contains `int x`.
LOCAL = 23;
- See Also:
- Constant Field Values
-
TAG_VALUE
public static final int TAG_VALUE
This node represents a tag.
TAG = 24;
- See Also:
- Constant Field Values
-
LOCATION_VALUE
public static final int LOCATION_VALUE
A location node summarizes a source code location.
LOCATION = 25;
- See Also:
- Constant Field Values
-
IDENTIFIER_VALUE
public static final int IDENTIFIER_VALUE
This node represents an identifier as used when referring to a variable by name. It holds the identifier's name in the `NAME` field and its fully-qualified type name in `TYPE_FULL_NAME`.
IDENTIFIER = 27;
- See Also:
- Constant Field Values
-
RETURN_VALUE
public static final int RETURN_VALUE
This node represents a return instruction, e.g., `return x`. Note that it does NOT represent a formal return parameter as formal return parameters are represented via `METHOD_RETURN` nodes.
RETURN = 30;
- See Also:
- Constant Field Values
-
BLOCK_VALUE
public static final int BLOCK_VALUE
This node represents a compound statement. Compound statements are used in many languages to allow grouping a sequence of statements. For example, in C and Java, compound statements are statements enclosed by curly braces. Function/Method bodies are compound statements. We do not use the term "compound statement" because "statement" would imply that the block does not yield a value upon evaluation, that is, that it is not an expression. This is true in languages such as C and Java, but not for languages such as Scala where the value of the block is given by that of the last expression it contains. In fact, the Scala grammar uses the term "BlockExpr" (short for "block expression") to describe what in the CPG we call "Block".
BLOCK = 31;
- See Also:
- Constant Field Values
-
METHOD_PARAMETER_OUT_VALUE
public static final int METHOD_PARAMETER_OUT_VALUE
This node represents a formal output parameter. Corresponding output parameters for input parameters MUST NOT be created by the frontend as they are automatically created upon first loading the CPG.
METHOD_PARAMETER_OUT = 33;
- See Also:
- Constant Field Values
-
METHOD_PARAMETER_IN_VALUE
public static final int METHOD_PARAMETER_IN_VALUE
This node represents a formal input parameter. The field `NAME` contains its name, while the field `TYPE_FULL_NAME` contains the fully qualified type name.
METHOD_PARAMETER_IN = 34;
- See Also:
- Constant Field Values
-
DEPENDENCY_VALUE
public static final int DEPENDENCY_VALUE
This node represents a dependency
DEPENDENCY = 35;
- See Also:
- Constant Field Values
-
FILE_VALUE
public static final int FILE_VALUE
File nodes represent source files or a shared objects from which the CPG was generated. File nodes serve as indices, that is, they allow looking up all elements of the code by file. For each file, the graph MUST contain exactly one File node. As file nodes are root nodes of abstract syntax tress, they are AstNodes and their order field is set to 0. This is because they have no sibling nodes, not because they are the first node of the AST. Each CPG MUST contain a special file node with name set to `<unknown>`. This node is a placeholder used in cases where a file cannot be determined at compile time. As an example, consider external library functions. As their code is not available on CPG construction, the file name is unknown. File nodes MUST NOT be created by the language frontend. Instead, the language frontend is assumed to fill out the `FILENAME` field wherever possible, allowing File nodes to be created automatically upon first loading the CPG.
FILE = 38;
- See Also:
- Constant Field Values
-
META_DATA_VALUE
public static final int META_DATA_VALUE
This node contains the CPG meta data. Exactly one node of this type MUST exist per CPG. The `HASH` property MAY contain a hash value calculated over the source files this CPG was generated from. The `VERSION` MUST be set to the version of the specification ("1.1"). The language field indicates which language frontend was used to generate the CPG and the list property `OVERLAYS` specifies which overlays have been applied to the CPG.
META_DATA = 39;
- See Also:
- Constant Field Values
-
NAMESPACE_VALUE
public static final int NAMESPACE_VALUE
This node represents a namespace. Similar to FILE nodes, NAMESPACE nodes serve as indices that allow all definitions inside a namespace to be obtained by following outgoing edges from a NAMESPACE node. NAMESPACE nodes MUST NOT be created by language frontends. Instead, they are generated from NAMESPACE_BLOCK nodes automatically upon first loading of the CPG.
NAMESPACE = 40;
- See Also:
- Constant Field Values
-
NAMESPACE_BLOCK_VALUE
public static final int NAMESPACE_BLOCK_VALUE
A reference to a namespace. We borrow the concept of a "namespace block" from C++, that is, a namespace block is a block of code that has been placed in the same namespace by a programmer. This block may be introduced via a `package` statement in Java or a `namespace{ }` statement in C++. The `FULL_NAME` field contains the namespace name in a human-readable format. The name should be given in dot-separated form where a dot indicates the the right hand side is a sub namespace of the left hand side, e.g., `foo.bar` denotes the namespace `bar` contained in the namespace `foo`. The `NAME` field contains the name of the namespace without the names of its parent namespaces, e.g., for the namespace `foo.woo.bar`, the `NAME` field is `bar`.
NAMESPACE_BLOCK = 41;
- See Also:
- Constant Field Values
-
UNKNOWN_VALUE
public static final int UNKNOWN_VALUE
Any AST node that the frontend would like to include in the AST but for which no suitable AST node is specified in the CPG specification may be included using a node of type `UNKNOWN`.
UNKNOWN = 44;
- See Also:
- Constant Field Values
-
TYPE_VALUE
public static final int TYPE_VALUE
This node represents a type instance, that is, a concrete instantiation of a type declaration.
TYPE = 45;
- See Also:
- Constant Field Values
-
TYPE_DECL_VALUE
public static final int TYPE_DECL_VALUE
This node represents a type declaration as for example given by a class-, struct-, or union declaration. In contrast to a `TYPE` node, this node does not represent a concrete instantiation of a type, e.g., for the parametrized type `List[T]`, it represents `List[T]`, but not `List[Integer]` where `Integer` is a concrete type. The language frontend MUST create type declarations for all types declared in the source program and MAY provide type declarations for types that are not declared but referenced by the source program. If a declaration is present in the source program, the field `IS_EXTERNAL` is set to `false`. Otherwise, it is set to `true`. The `FULL_NAME` field specifies the type's fully-qualified name, including information about the namespace it is contained in if applicable, the name field is the type's short name. Line and column number information is specified in the optional fields `LINE_NUMBER`, `COLUMN_NUMBER`, `LINE_NUMBER_END`, and `COLUMN_NUMBER_END` and the name of the source file is specified in `FILENAME`. Base types can be specified via the `INHERITS_FROM_TYPE_FULL_NAME` list, where each entry contains the fully-qualified name of a base type. If the type is known to be an alias of another type (as for example introduced via the C `typedef` statement), the name of the alias is stored in `ALIAS_TYPE_FULL_NAME`. Finally, the fully qualified name of the program constructs that the type declaration is immediately contained in is stored in the `AST_PARENT_FULL_NAME` field and its type is indicated in the `AST_PARENT_TYPE` field to be one of `METHOD`, `TYPE_DECL` or `NAMESPACE_BLOCK`.
TYPE_DECL = 46;
- See Also:
- Constant Field Values
-
TYPE_PARAMETER_VALUE
public static final int TYPE_PARAMETER_VALUE
This node represents a formal type parameter, that is, the type parameter as given in a type-parametrized method or type declaration. Examples for languages that support type parameters are Java (via Generics) and C++ (via templates). Apart from the standard fields of AST nodes, the type parameter carries only a `NAME` field that holds the parameters name.
TYPE_PARAMETER = 47;
- See Also:
- Constant Field Values
-
TYPE_ARGUMENT_VALUE
public static final int TYPE_ARGUMENT_VALUE
An (actual) type argument as used to instantiate a parametrized type, in the same way an (actual) arguments provides concrete values for a parameter at method call sites. As it true for arguments, the method is not expected to interpret the type argument. It MUST however store its code in the `CODE` field.
TYPE_ARGUMENT = 48;
- See Also:
- Constant Field Values
-
CONFIG_FILE_VALUE
public static final int CONFIG_FILE_VALUE
This node type represent a configuration file, where `NAME` is the name of the file and `content` is its content. The exact representation of the name is left undefined and can be chosen as required by consumers of the corresponding configuration files.
CONFIG_FILE = 50;
- See Also:
- Constant Field Values
-
BINDING_VALUE
public static final int BINDING_VALUE
`BINDING` nodes represent name-signature pairs that can be resolved at a type declaration (`TYPE_DECL`). They are connected to `TYPE_DECL` nodes via incoming `BINDS` edges and to the methods they resolve to via outgoing `REF` edges.
BINDING = 146;
- See Also:
- Constant Field Values
-
TAG_NODE_PAIR_VALUE
public static final int TAG_NODE_PAIR_VALUE
This node contains an arbitrary node and an associated tag node.
TAG_NODE_PAIR = 208;
- See Also:
- Constant Field Values
-
FINDING_VALUE
public static final int FINDING_VALUE
Finding nodes may be used to store analysis results in the graph that are to be exposed to an end-user, e.g., information about potential vulnerabilities or dangerous programming practices. A Finding node may contain an abitrary list of key value pairs that characterize the finding, as well as a list of nodes that serve as evidence for the finding.
FINDING = 214;
- See Also:
- Constant Field Values
-
KEY_VALUE_PAIR_VALUE
public static final int KEY_VALUE_PAIR_VALUE
This node represents a key value pair, where both the key and the value are strings.
KEY_VALUE_PAIR = 217;
- See Also:
- Constant Field Values
-
MODIFIER_VALUE
public static final int MODIFIER_VALUE
This field represents a (language-dependent) modifier such as `static`, `private` or `public`. Unlike most other AST nodes, it is NOT an expression, that is, it cannot be evaluated and cannot be passed as an argument in function calls.
MODIFIER = 300;
- See Also:
- Constant Field Values
-
METHOD_REF_VALUE
public static final int METHOD_REF_VALUE
This node represents a reference to a method/function/procedure as it appears when a method is passed as an argument in a call. The `METHOD_FULL_NAME` field holds the fully-qualified name of the referenced method and the `TYPE_FULL_NAME` holds its fully-qualified type name.
METHOD_REF = 333;
- See Also:
- Constant Field Values
-
CLOSURE_BINDING_VALUE
public static final int CLOSURE_BINDING_VALUE
Represents the binding of a LOCAL or METHOD_PARAMETER_IN into the closure of a method
CLOSURE_BINDING = 334;
- See Also:
- Constant Field Values
-
TYPE_REF_VALUE
public static final int TYPE_REF_VALUE
Reference to a type/class
TYPE_REF = 335;
- See Also:
- Constant Field Values
-
CONTROL_STRUCTURE_VALUE
public static final int CONTROL_STRUCTURE_VALUE
This node represents a control structure as introduced by control structure statements as well as conditional and unconditional jumps. Its type is stored in the `CONTROL_STRUCTURE_TYPE` field to be one of several pre-defined types. These types are used in the construction of the control flow layer, making it possible to generate the control flow layer from the abstract syntax tree layer automatically. In addition to the `CONTROL_STRUCTURE_TYPE` field, the `PARSER_TYPE_NAME` field MAY be used by frontends to store the name of the control structure as emitted by the parser or disassembler, however, the value of this field is not relevant for construction of the control flow layer.
CONTROL_STRUCTURE = 339;
- See Also:
- Constant Field Values
-
JUMP_TARGET_VALUE
public static final int JUMP_TARGET_VALUE
A jump target is any location in the code that has been specifically marked as the target of a jump, e.g., via a label. The `NAME` field holds the name of the label while the `PARSER_TYPE_NAME` field holds the name of language construct that this jump target is created from, e.g., "Label".
JUMP_TARGET = 340;
- See Also:
- Constant Field Values
-
COMMENT_VALUE
public static final int COMMENT_VALUE
A source code comment
COMMENT = 511;
- See Also:
- Constant Field Values
-
FIELD_IDENTIFIER_VALUE
public static final int FIELD_IDENTIFIER_VALUE
This node represents the field accessed in a field access, e.g., in `a.b`, it represents `b`. The field name as it occurs in the code is stored in the `CODE` field. This may mean that the `CODE` field holds an expression. The `CANONICAL_NAME` field MAY contain the same value is the `CODE` field but SHOULD contain the normalized name that results from evaluating `CODE` as an expression if such an evaluation is possible for the language frontend. The objective is to store an identifier in `CANONICAL_NAME` that is the same for two nodes iff they refer to the same field, regardless of whether they use the same expression to reference it.
FIELD_IDENTIFIER = 2001081;
- See Also:
- Constant Field Values
-
-
Method Detail
-
values
public static Cpg.CpgStruct.Node.NodeType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Cpg.CpgStruct.Node.NodeType c : Cpg.CpgStruct.Node.NodeType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Cpg.CpgStruct.Node.NodeType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getNumber
public final int getNumber()
- Specified by:
getNumber
in interfacecom.google.protobuf.Internal.EnumLite
- Specified by:
getNumber
in interfacecom.google.protobuf.ProtocolMessageEnum
-
valueOf
@Deprecated public static Cpg.CpgStruct.Node.NodeType valueOf(int value)
Deprecated.Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
value
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
forNumber
public static Cpg.CpgStruct.Node.NodeType forNumber(int value)
- Parameters:
value
- The numeric wire value of the corresponding enum entry.- Returns:
- The enum associated with the given numeric wire value.
-
internalGetValueMap
public static com.google.protobuf.Internal.EnumLiteMap<Cpg.CpgStruct.Node.NodeType> internalGetValueMap()
-
getValueDescriptor
public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor()
- Specified by:
getValueDescriptor
in interfacecom.google.protobuf.ProtocolMessageEnum
-
getDescriptorForType
public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType()
- Specified by:
getDescriptorForType
in interfacecom.google.protobuf.ProtocolMessageEnum
-
getDescriptor
public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor()
-
valueOf
public static Cpg.CpgStruct.Node.NodeType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
desc
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
-