|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--scale.common.Root
|
+--scale.clef.Node
|
+--scale.clef.type.Type
|
+--scale.clef.type.RefType
A RefType node is used to represent an exisiting type when attributes must be set on a new equivalent type.
$Id: RefType.java,v 1.45 2002/01/03 21:44:14 burrill Exp $
Copyright 2002 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
For example:
char *s; typedef const char *Identifier; Identifier id;would be represented in clef as:
VariableDecl(s) VariableDecl(id) TypeDecl(Identifier)
\ | |
\ | |
\ v v
\ RefType{const}
\ /
\ /
| |
v v
PointerType
|
v
CharacterType
| Field Summary | |
static java.lang.String[] |
attributeMap
|
static int |
cConstantType
Indicates that instances of this type have a constant value. |
static int |
cNone
This section describes what attributes are associated with a type. |
static int |
cOrdered
For types with substructures, this attribute indicates if the source language requires the data layout to preserve the order of substructures (declaration order is assumed). |
static int |
cTraced
Supports Modula-3's traced data types. |
static int |
cUnordered
For types with substructures, this attribute indicates if the type may be layed out in an arbitrary order. |
static int |
cUntraced
Supports Modula-3's untraced data types. |
static int |
cVaList
For the type that represents the builtin type va_list. |
static int |
cVolatile
Marks a value which may be changed by something which a compiler cannot detect. |
| Fields inherited from interface scale.common.DisplayNode |
ANNO, CLEF, DD, DEFUSE, DOM, EXPR, MAYUSE, TYPE |
| Method Summary | |
int |
alignment(Machine machine)
Calculate the alignment needed for this data type. |
static RefType |
create(Type refTo,
Declaration myDecl)
|
static RefType |
create(Type refTo,
int attribute)
|
static RefType |
create(Type refTo,
int attribute,
Declaration myDecl)
Re-use an existing instance of a particular reference type. |
protected Vector |
createChildren()
Create the list of children for the node - each node that has children must implement this method. |
boolean |
equivalent(Type t)
Return true if the types are equivalent. |
protected void |
finalize()
Keep the count of instances up-to-date. |
int |
getAttribute()
Return the attribute of this type reference. |
Type |
getCoreType()
This method filters out some the special case type nodes from a type DAG. |
Declaration |
getDecl()
Return the TypeDecl or TypeName of this type reference. |
java.lang.String |
getDisplayText()
Return a String suitable for labeling this node in a graphical display. |
Type |
getRefTo()
|
static java.util.Enumeration |
getTypes()
Return an Enumeration of all the different types. |
boolean |
isAddressType()
Return true if type represents the address of something. |
boolean |
isAggregateType()
Return true if type represents an aggregate object. |
boolean |
isArrayType()
Return true if type represents an array. |
boolean |
isAtomicType()
Return true if type represents a scaler value. |
boolean |
isAttributeSet(int attribute)
Return true if the attribute is associated with this type. |
boolean |
isComplexType()
Return true if type represents a complex value. |
boolean |
isCompositeType()
Return true if type represents a composite type. |
boolean |
isConst()
Return true if the type specifies const. |
boolean |
isIntegerType()
Return true if type represents an integer value. |
boolean |
isNamedType()
Return true if this type has an associated TypeName or TypeDecl. |
boolean |
isNumericType()
Return true if type represents a numeric value. |
boolean |
isPointerType()
Return true if type represents an address. |
boolean |
isRealType()
Return true if type represents a floating point value. |
boolean |
isSigned()
Return true is the type is signed. |
boolean |
isVoidType()
Return true if type represents no type. |
boolean |
isVolatile()
Return true if the type specifies volatile. |
int |
memorySize(Machine machine)
Calculate how many addressable memory units are needed to represent the type. |
static int |
number()
Return the current number of instances of this class. |
java.lang.String |
toString()
|
java.lang.String |
toStringShort()
|
void |
visit(Predicate p)
The visit() method is used to implement a visit 'pattern'. |
| Methods inherited from class scale.clef.type.Type |
getCompleteType, getDisplayColorHint, getDisplayShapeHint, getPointedTo, getTag, getType, nextVisit, setTag, setVisited, visited |
| Methods inherited from class scale.clef.Node |
getChildren, getParent, setAnnotationLevel, setParent, setReportLevel, toString, toStringChildren, toStringSpecial |
| Methods inherited from class scale.common.Root |
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayName, getDisplayString, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, hashCode, removeAnnotation, removeAnnotations, toStringAnnotations, toStringClass |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int cNone
public static final int cTraced
public static final int cUntraced
public static final int cConstantType
One could reasonably argue that the immutability of a value is not a property (or attribute) of a type. However, C++'s typedef construct permits immutability to be included with the type.
public static final int cVolatile
public static final int cOrdered
public static final int cUnordered
public static final int cVaList
public static final java.lang.String[] attributeMap
| Method Detail |
protected void finalize()
throws java.lang.Throwable
finalize in class Typejava.lang.Throwable - [needs description]public static int number()
public static RefType create(Type refTo,
int attribute,
Declaration myDecl)
refTo - the actual typeattribute - an attribute of the typemyDecl - null or a TypeName or TypeDecl declaration
public static RefType create(Type refTo,
Declaration myDecl)
public static RefType create(Type refTo,
int attribute)
public final Type getRefTo()
public boolean isAttributeSet(int attribute)
isAttributeSet in class Typescale.clef.type.TypeRefTypepublic int getAttribute()
public boolean isConst()
isConst in class Typepublic boolean isVolatile()
isVolatile in class Typepublic Declaration getDecl()
getDecl in class Nodepublic void visit(Predicate p)
Nodevisit in class Typeprotected Vector createChildren()
NodecreateChildren in class Nodescale.clef.Nodepublic Type getCoreType()
getCoreType in class TypeType.getCoreType()public boolean isAddressType()
isAddressType in class Typepublic boolean isArrayType()
isArrayType in class Typepublic boolean isPointerType()
isPointerType in class Typepublic boolean isVoidType()
isVoidType in class Typepublic boolean isAggregateType()
isAggregateType in class Typepublic boolean isCompositeType()
isCompositeType in class Typepublic boolean isRealType()
isRealType in class Typepublic boolean isIntegerType()
isIntegerType in class Typepublic boolean isComplexType()
isComplexType in class Typepublic boolean isAtomicType()
isAtomicType in class Typepublic boolean isNumericType()
isNumericType in class Typepublic boolean isNamedType()
isNamedType in class Typepublic boolean isSigned()
isSigned in class Typepublic int memorySize(Machine machine)
memorySize in class Typemachine - is the machine-specific data machinepublic int alignment(Machine machine)
alignment in class Typepublic boolean equivalent(Type t)
equivalent in class Typepublic static java.util.Enumeration getTypes()
public java.lang.String getDisplayText()
getDisplayText in class Typepublic java.lang.String toString()
toString in class Typepublic java.lang.String toStringShort()
toStringShort in class Type
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||