Class Type
java.lang.Object
de.fraunhofer.aisec.cpg.graph.Node
de.fraunhofer.aisec.cpg.graph.types.Type
- All Implemented Interfaces:
Persistable,IVisitable<de.fraunhofer.aisec.cpg.graph.Node>
- Direct Known Subclasses:
FunctionPointerType,IncompleteType,ObjectType,ParameterizedType,PointerType,ReferenceType,UnknownType
public abstract class Type
extends de.fraunhofer.aisec.cpg.graph.Node
Abstract Type, describing all possible SubTypes, i.e. all different Subtypes are compliant with
this class. Contains information which is included in any Type such as name, storage, qualifier
and origin
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classType.OriginType Origin describes where the Type information came fromstatic classType.QualifierDescribes possible qualifiers that can be added to the type in order to modify its behavior.static classType.StorageDescribes Storage specifier of variables.Nested classes/interfaces inherited from class de.fraunhofer.aisec.cpg.graph.Node
de.fraunhofer.aisec.cpg.graph.Node.Companion -
Field Summary
Fields Modifier and Type Field Description protected Type.Originoriginprotected booleanprimitiveprotected Type.Qualifierqualifierprotected @NonNull Type.Storagestorageauto, extern, static, register: consider "auto" as modifier or auto to automatically infer the value.protected @NonNull java.util.Set<Type>superTypesstatic java.lang.StringUNKNOWN_TYPE_STRINGFields inherited from class de.fraunhofer.aisec.cpg.graph.Node
Companion, EMPTY_NAME, TO_STRING_STYLE -
Constructor Summary
Constructors Constructor Description Type()Type(Type type)Type(java.lang.String typeName)Type(java.lang.String typeName, @Nullable Type.Storage storage, Type.Qualifier qualifier) -
Method Summary
Modifier and Type Method Description abstract Typedereference()abstract Typeduplicate()booleanequals(java.lang.Object o)Type.QualifiergetQualifier()intgetReferenceDepth()TypegetRoot()Obtain the root Type Element for a Type Chain (follows Pointer and ReferenceTypes until Object- Incomplete- FunctionPtrType is reached@NonNull Type.StoragegetStorage()@NonNull java.util.Set<Type>getSuperTypes()All direct supertypes of this type.java.lang.StringgetTypeName()Type.OrigingetTypeOrigin()inthashCode()booleanisFirstOrderType()booleanisPrimitive()booleanisSimilar(Type t)Required for possibleSubTypes to check if the new Type should be considered a subtype or notabstract Typereference(PointerType.PointerOrigin pointer)voidrefreshNames()voidsetAdditionalTypeKeywords(java.lang.String keywords)voidsetQualifier(Type.Qualifier qualifier)voidsetRoot(Type newRoot)voidsetStorage(@NonNull Type.Storage storage)voidsetTypeOrigin(Type.Origin origin)java.lang.StringtoString()Methods inherited from class de.fraunhofer.aisec.cpg.graph.Node
addAnnotations, addNextDFG, addNextEOG, addPrevDFG, addPrevEOG, addTypedef, clearNextEOG, disconnectFromGraph, getAnnotations, getArgumentIndex, getCode, getComment, getFile, getId, getLocation, getName, getNextDFG, getNextEOG, getNextEOGEdges, getPrevDFG, getPrevEOG, getPrevEOGEdges, getTypedefs, isImplicit, isInferred, removeNextDFG, removePrevDFG, removePrevEOGEntry, setAnnotations, setArgumentIndex, setCode, setComment, setFile, setId, setImplicit, setInferred, setLocation, setName, setNextDFG, setNextEOG, setNextEOGEdges, setPrevDFG, setPrevEOG, setPrevEOGEdges, setTypedefsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface de.fraunhofer.aisec.cpg.processing.IVisitable
accept
-
Field Details
-
UNKNOWN_TYPE_STRING
public static final java.lang.String UNKNOWN_TYPE_STRING- See Also:
- Constant Field Values
-
superTypes
-
storage
auto, extern, static, register: consider "auto" as modifier or auto to automatically infer the value. -
primitive
protected boolean primitive -
qualifier
-
origin
-
-
Constructor Details
-
Type
public Type() -
Type
public Type(java.lang.String typeName) -
Type
-
Type
-
-
Method Details
-
getSuperTypes
All direct supertypes of this type.- Returns:
-
getStorage
-
setStorage
-
getQualifier
-
setQualifier
-
getTypeOrigin
-
setTypeOrigin
-
isPrimitive
public boolean isPrimitive() -
reference
- Parameters:
pointer- Reason for the reference (array of pointer)- Returns:
- Returns a reference to the current Type. E.g. when creating a pointer to an existing ObjectType
-
dereference
- Returns:
- Dereferences the current Type by resolving the reference. E.g. when dereferencing an pointer type we obtain the type the pointer is pointing towards
-
refreshNames
public void refreshNames() -
getRoot
Obtain the root Type Element for a Type Chain (follows Pointer and ReferenceTypes until Object- Incomplete- FunctionPtrType is reached- Returns:
- root Type
-
setRoot
-
duplicate
- Returns:
- Creates an exact copy of the current type (chain)
-
getTypeName
public java.lang.String getTypeName() -
getReferenceDepth
public int getReferenceDepth()- Returns:
- number of steps that are required in order to traverse the type chain until the root is reached
-
setAdditionalTypeKeywords
public void setAdditionalTypeKeywords(java.lang.String keywords) -
isFirstOrderType
public boolean isFirstOrderType()- Returns:
- True if the Type parameter t is a FirstOrderType (Root of a chain) and not a Pointer or RefrenceType
-
isSimilar
Required for possibleSubTypes to check if the new Type should be considered a subtype or not- Parameters:
t- other type the similarity is checked with- Returns:
- True if the parameter t is equal to the current type (this)
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classde.fraunhofer.aisec.cpg.graph.Node
-
hashCode
public int hashCode()- Overrides:
hashCodein classde.fraunhofer.aisec.cpg.graph.Node
-
toString
@NotNull public java.lang.String toString()- Overrides:
toStringin classde.fraunhofer.aisec.cpg.graph.Node
-