Class Type
- java.lang.Object
-
- de.fraunhofer.aisec.cpg.graph.Node
-
- de.fraunhofer.aisec.cpg.graph.types.Type
-
- All Implemented Interfaces:
Persistable,IVisitable<Node>
- Direct Known Subclasses:
FunctionPointerType,IncompleteType,ObjectType,ParameterizedType,PointerType,ReferenceType,UnknownType
public abstract class Type extends 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.
-
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_STRING
-
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
All Methods Instance Methods Abstract Methods Concrete Methods 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, addNextCFG, addNextCFG, addNextDFG, addNextEOG, addPrevDFG, addPrevEOG, addTypedef, clearNextEOG, disconnectFromGraph, getAnnotations, getArgumentIndex, getCode, getFile, getId, getLocation, getName, getNextCFG, getNextDFG, getNextEOG, getNextEOGProperties, getNextEOGPropertyEdge, getPrevDFG, getPrevEOG, getPrevEOGProperties, getTypedefs, isDummy, isImplicit, removeNextDFG, removePrevDFG, removePrevEOGEntries, removePrevEOGEntry, setArgumentIndex, setCode, setComment, setDummy, setFile, setImplicit, setLocation, setName, setNextDFG, setNextEOG, setPrevDFG, setPrevEOG, setPrevEOGProperties, setTypedefs
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.fraunhofer.aisec.cpg.processing.IVisitable
accept
-
-
-
-
Field Detail
-
UNKNOWN_TYPE_STRING
public static final java.lang.String UNKNOWN_TYPE_STRING
- See Also:
- Constant Field Values
-
superTypes
protected @NonNull java.util.Set<Type> superTypes
-
storage
protected @NonNull Type.Storage storage
auto, extern, static, register: consider "auto" as modifier or auto to automatically infer the value.
-
primitive
protected boolean primitive
-
qualifier
protected Type.Qualifier qualifier
-
origin
protected Type.Origin origin
-
-
Constructor Detail
-
Type
public Type()
-
Type
public Type(java.lang.String typeName)
-
Type
public Type(Type type)
-
Type
public Type(java.lang.String typeName, @Nullable Type.Storage storage, Type.Qualifier qualifier)
-
-
Method Detail
-
getSuperTypes
public @NonNull java.util.Set<Type> getSuperTypes()
All direct supertypes of this type.- Returns:
-
getStorage
public @NonNull Type.Storage getStorage()
-
setStorage
public void setStorage(@NonNull Type.Storage storage)
-
getQualifier
public Type.Qualifier getQualifier()
-
setQualifier
public void setQualifier(Type.Qualifier qualifier)
-
getTypeOrigin
public Type.Origin getTypeOrigin()
-
setTypeOrigin
public void setTypeOrigin(Type.Origin origin)
-
isPrimitive
public boolean isPrimitive()
-
reference
public abstract Type reference(PointerType.PointerOrigin pointer)
- 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
public abstract Type 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
public Type getRoot()
Obtain the root Type Element for a Type Chain (follows Pointer and ReferenceTypes until Object- Incomplete- FunctionPtrType is reached- Returns:
- root Type
-
setRoot
public void setRoot(Type newRoot)
-
duplicate
public abstract Type 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
public boolean isSimilar(Type t)
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)
-
-