public abstract class Type extends Object implements TypeComparator.SemanticEqualityOp, ASTLocusTag.ASTLocusTagProvider
Modifier and Type | Field and Description |
---|---|
boolean |
relaxedEqSem |
Modifier | Constructor and Description |
---|---|
protected |
Type(String name,
SizeThunk size,
int cvAttributes,
ASTLocusTag astLocus) |
Modifier and Type | Method and Description |
---|---|
int |
arrayDimension()
Helper method for determining how many array dimentions this
type represents (i.e., "char[][]" returns 2).
|
ArrayType |
asArray()
Casts this to an ArrayType or returns null if not an ArrayType.
|
BitType |
asBit()
Casts this to a BitType or returns null if not a BitType.
|
CompoundType |
asCompound()
Casts this to a CompoundType or returns null if not a CompoundType.
|
DoubleType |
asDouble()
Casts this to a DoubleType or returns null if not a DoubleType.
|
EnumType |
asEnum()
Casts this to an EnumType or returns null if not an EnumType.
|
FloatType |
asFloat()
Casts this to a FloatType or returns null if not a FloatType.
|
FunctionType |
asFunction()
Casts this to a FunctionType or returns null if not a FunctionType.
|
IntType |
asInt()
Casts this to an IntType or returns null if not an IntType.
|
PointerType |
asPointer()
Casts this to a PointerType or returns null if not a PointerType.
|
VoidType |
asVoid()
Casts this to a VoidType or returns null if not a VoidType.
|
protected void |
clearCache() |
Type |
clone(ASTLocusTag newLoc)
Clones this instance using a new
ASTLocusTag . |
boolean |
equals(Object arg)
Equality test for Types inclusive its given
name . |
boolean |
equalSemantics(TypeComparator.SemanticEqualityOp arg)
Semantic equality test for Types exclusive its given
name . |
protected abstract boolean |
equalSemanticsImpl(Type t) |
protected abstract boolean |
equalsImpl(Type t) |
ASTLocusTag |
getASTLocusTag()
Returns this instance's
ASTLocusTag , if available,
otherwise returns null . |
Type |
getBaseElementType()
Helper method to returns the bottom-most element type of this type.
|
String |
getCName()
Returns the name of this type.
|
String |
getCName(boolean includeCVAttrs)
Returns the name of this type, optionally including
const/volatile attributes.
|
int |
getCVAttributes() |
String |
getCVAttributesString()
Returns a string indicating the const/volatile attributes of
this type.
|
String |
getDebugString() |
String |
getName()
Returns the name of this type.
|
String |
getName(boolean includeCVAttrs)
Returns the name of this type, optionally including
const/volatile attributes.
|
SizeThunk |
getSize()
SizeThunk which computes size of this type in bytes.
|
long |
getSize(MachineDataInfo machDesc)
Size of this type in bytes according to the given MachineDataInfo.
|
Type |
getTargetType()
Helper method to returns the target type of this type, in case another type is being referenced.
|
int |
hashCode()
Hashcode for Types.
|
protected abstract int |
hashCodeImpl() |
int |
hashCodeSemantics()
Semantic hashcode for Types exclusive its given
name . |
protected abstract int |
hashCodeSemanticsImpl() |
boolean |
isAnon() |
boolean |
isArray()
Indicates whether this is an ArrayType.
|
boolean |
isBaseTypeConst()
Checks the base type of pointer-to-pointer, pointer, array or plain for const-ness.
|
boolean |
isBit()
Indicates whether this is a BitType.
|
boolean |
isCompound()
Indicates whether this is a CompoundType.
|
boolean |
isConst()
Indicates whether this type is const.
|
boolean |
isDouble()
Indicates whether this is a DoubleType.
|
boolean |
isEnum()
Indicates whether this is an EnumType.
|
boolean |
isFloat()
Indicates whether this is a FloatType.
|
boolean |
isFunction()
Indicates whether this is a FunctionType.
|
boolean |
isFunctionPointer()
Convenience routine indicating whether this Type is a pointer to
a function.
|
boolean |
isInt()
Indicates whether this is an IntType.
|
boolean |
isPointer()
Indicates whether this is a PointerType.
|
boolean |
isPrimitive()
Indicates whether this type is a primitive type.
|
boolean |
isTypedef()
Indicates whether this type is a typedef type,
i.e.
|
boolean |
isVoid()
Indicates whether this is a VoidType.
|
boolean |
isVolatile()
Indicates whether this type is volatile.
|
Type |
newCVVariant(int cvAttributes)
Return a variant of this type matching the given const/volatile
attributes.
|
int |
pointerDepth()
Helper method for determining how many pointer indirections this
type represents (i.e., "void **" returns 2).
|
boolean |
setTypedefName(String name)
Set the typedef name of this type and renders this type a typedef,
if given
name has a length. |
String |
toString()
Returns a string representation of this type.
|
void |
visit(TypeVisitor visitor)
Traverse this
Type and all of its component types; for
example, the return type and argument types of a FunctionType. |
protected Type(String name, SizeThunk size, int cvAttributes, ASTLocusTag astLocus)
protected final void clearCache()
public final Type newCVVariant(int cvAttributes)
public Type clone(ASTLocusTag newLoc)
ASTLocusTag
.public final ASTLocusTag getASTLocusTag()
ASTLocusTag.ASTLocusTagProvider
ASTLocusTag
, if available,
otherwise returns null
.getASTLocusTag
in interface ASTLocusTag.ASTLocusTagProvider
public boolean isAnon()
public final String getCName()
public String getCName(boolean includeCVAttrs)
public final String getName()
public String getName(boolean includeCVAttrs)
public String toString()
public final String getDebugString()
public boolean setTypedefName(String name)
name
has a length.
Method issues clearCache()
, to force re-evaluation
of hashes.
public final boolean isTypedef()
setTypedefName(String)
.public final SizeThunk getSize()
public final long getSize(MachineDataInfo machDesc)
public BitType asBit()
public IntType asInt()
public EnumType asEnum()
public FloatType asFloat()
public DoubleType asDouble()
public PointerType asPointer()
public ArrayType asArray()
public CompoundType asCompound()
public FunctionType asFunction()
public VoidType asVoid()
public final boolean isBit()
public final boolean isInt()
public final boolean isEnum()
public final boolean isFloat()
public final boolean isDouble()
public final boolean isPointer()
public final boolean isArray()
public final boolean isCompound()
public final boolean isFunction()
public final boolean isVoid()
public final boolean isVolatile()
public final boolean isConst()
public boolean isPrimitive()
public boolean isFunctionPointer()
public final boolean isBaseTypeConst()
Note: Intermediate 'const' qualifier are not considered, e.g. const pointer.
protected abstract int hashCodeImpl()
protected abstract boolean equalsImpl(Type t)
public final int hashCodeSemantics()
TypeComparator.SemanticEqualityOp
name
.hashCodeSemantics
in interface TypeComparator.SemanticEqualityOp
#equalSemantics(SemanticEqualityOp)
protected abstract int hashCodeSemanticsImpl()
public final boolean equalSemantics(TypeComparator.SemanticEqualityOp arg)
TypeComparator.SemanticEqualityOp
name
.equalSemantics
in interface TypeComparator.SemanticEqualityOp
TypeComparator.SemanticEqualityOp.hashCodeSemantics()
protected abstract boolean equalSemanticsImpl(Type t)
public void visit(TypeVisitor visitor)
Type
and all of its component types; for
example, the return type and argument types of a FunctionType.public final int getCVAttributes()
public final String getCVAttributesString()
public int pointerDepth()
public int arrayDimension()
public Type getBaseElementType()
If this is a multidimensional array or pointer method returns the bottom-most element type, otherwise this.
public Type getTargetType()