Types are associated with each identifier and expression
Types are associated with each identifier and expression
Returns the getTrueType of the base type being described IF there
are no descriptors which are not masked out. The following masks
can be specified as an optional second argument:
MASK_NO_DESCRIPTORS: Do not mask out anything.
MASK_MOST_DESCRIPTORS: Only leave in: signed, unsigned, short, long,
const, volatile.
MASK_ALL_DESCRIPTORS: Mask out everything. If you build your own mask, you should make sure that the traits
you want to set out have their bits UN-set, and the rest should have
their bits set. The complementation (~) operator is a good one to use. See libSage++.h, where the MASK_*_DESCRIPTORS variables are defined.
This code currently assumes that:
o If you follow the dereferencing pointer (PTR(-1)), you find another
pointer type or an array type. We do NOT assume that the following situation cannot occur:
PTR(-1) -> PTR(-1) -> PTR(1) -> PTR(1) -> PTR(-1) -> PTR(1) This means there may be more pointers to follow after we come to
an initial "equilibrium". ALGORITHM: T_POINTER:
[WARNING: No consideration is given to pointers with attributes
(ls_flags) set. For instance, a const pointer is treated the same
as any other pointer.] 1. Return the same type we got if it is not a pointer type or
the pointer is not a dereferencing pointer type. 2. Repeat { get next pointer , add its indirection to current total }
until the current total is 0. We have reached an equilibrium, so
the next type will not necessarily be a pointer type. 3. Check the next type for further indirection with another call
to getTrueType. T_DESCRIPT:
Returns the result of maskDescriptors called with the given type and mask. T_ARRAY:
If the array has zero dimensions, we pass over it. This type arose
for me in the following situation:
double x[2];
x[1] = 0; T_DERIVED_TYPE:
If we have been told to follow typedefs, get the type of the
symbol from which this type is derived from, and continue digging.
Otherwise return this type.
HITCHES:
Some programs may dereference a T_ARRAY as a pointer, so we need
to be prepared to deal with that.
SgType(int variant)
SgType(int var, SgExpression *len, SgType *base)
SgType(int var, SgSymbol *symb)
SgType(int var, SgSymbol *firstfield, SgStatement *structstmt)
SgType(PTR_TYPE type)
SgType(SgType &)
int variant()
int id()
SgSymbol* symbol()
SgType& copy()
SgType* copyPtr()
SgType* next()
int isTheElementType()
int equivalentToType(SgType &type)
int equivalentToType(SgType *type)
SgType* internalBaseType()
int hasBaseType()
SgType* baseType()
SgExpression* length()
SgType* maskDescriptors(int mask)
SgType* getTrueType(int mask = MASK_MOST_DESCRIPTORS, int follow_typedefs = 0)
int numberOfAttributes()
int numberOfAttributes(int type)
void* attributeValue(int i)
int attributeType(int i)
void* attributeValue(int i, int type)
void* deleteAttribute(int i)
void addAttribute(int type, void *a, int size)
void addAttribute(int type)
void addAttribute(void *a, int size)
void addAttribute(SgAttribute *att)
Email contact: zgs@npac.syr.edu