Example #1
0
SymEntry* FindStructField (const Type* T, const char* Name)
/* Find a struct field in the fields list */
{
    SymEntry* Field = 0;

    /* The given type may actually be a pointer to struct */
    if (IsTypePtr (T)) {
        ++T;
    }

    /* Non-structs do not have any struct fields... */
    if (IsClassStruct (T)) {

        /* Get a pointer to the struct/union type */
        const SymEntry* Struct = GetSymEntry (T);
        CHECK (Struct != 0);

        /* Now search in the struct symbol table. Beware: The table may not
        ** exist.
        */
        if (Struct->V.S.SymTab) {
            Field = FindSymInTable (Struct->V.S.SymTab, Name, HashStr (Name));
        }
    }

    return Field;
}
Example #2
0
void SetSymEntry (Type* T, SymEntry* S)
/* Set the SymEntry pointer for a type */
{
    /* Only structs or unions have a SymEntry attribute */
    CHECK (IsClassStruct (T));

    /* Set the attribute */
    T->A.P = S;
}
Example #3
0
SymEntry* GetSymEntry (const Type* T)
/* Return a SymEntry pointer from a type */
{
    /* Only structs or unions have a SymEntry attribute */
    CHECK (IsClassStruct (T));

    /* Return the attribute */
    return T->A.P;
}
Example #4
0
int TypeHasAttr (const Type* T)
/* Return true if the given type has attribute data */
{
    return IsClassStruct (T) || IsTypeArray (T) || IsClassFunc (T);
}