Ignore:
Timestamp:
May 16, 2015, 3:36:19 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
a32b204
Parents:
b8508a2
Message:

licencing: first groups of files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/Parser/TypeData.h

    rb8508a2 rb87a5ed  
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
     3//
     4// The contents of this file are covered under the licence agreement in the
     5// file "LICENCE" distributed with Cforall.
     6//
     7// TypeData.h --
     8//
     9// Author           : Rodolfo G. Esteves
     10// Created On       : Sat May 16 15:18:36 2015
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat May 16 15:20:00 2015
     13// Update Count     : 2
     14//
     15
    116#ifndef TYPEDATA_H
    217#define TYPEDATA_H
     
    823
    924struct TypeData {
    10     enum Kind { Unknown, Basic, Pointer, Array, Function, Aggregate, AggregateInst,
    11                 Enum, EnumConstant, Symbolic, SymbolicInst, Variable, Tuple, Typeof, Attr } kind;
     25        enum Kind { Unknown, Basic, Pointer, Array, Function, Aggregate, AggregateInst,
     26                                Enum, EnumConstant, Symbolic, SymbolicInst, Variable, Tuple, Typeof, Attr } kind;
    1227
    13     TypeData( Kind k = Unknown );
    14     ~TypeData();
    15     void print( std::ostream &, int indent = 0 ) const;
    16     TypeData *clone() const;
     28        TypeData( Kind k = Unknown );
     29        ~TypeData();
     30        void print( std::ostream &, int indent = 0 ) const;
     31        TypeData *clone() const;
    1732
    18     Type *build() const;
    19     FunctionType *buildFunction() const;
     33        Type *build() const;
     34        FunctionType *buildFunction() const;
    2035
    21     TypeData *base;
    22     std::list< DeclarationNode::Qualifier > qualifiers;
    23     DeclarationNode *forall;
     36        TypeData *base;
     37        std::list< DeclarationNode::Qualifier > qualifiers;
     38        DeclarationNode *forall;
    2439
    25     struct Basic_t {
    26         std::list< DeclarationNode::BasicType > typeSpec;
    27         std::list< DeclarationNode::Modifier > modifiers;
    28     };
     40        struct Basic_t {
     41                std::list< DeclarationNode::BasicType > typeSpec;
     42                std::list< DeclarationNode::Modifier > modifiers;
     43        };
    2944
    30     struct Aggregate_t {
    31         DeclarationNode::TyCon kind;
    32         std::string name;
    33         DeclarationNode *params;
    34         ExpressionNode *actuals;                        // holds actual parameters later applied to AggInst
    35         DeclarationNode *members;
    36     };
     45        struct Aggregate_t {
     46                DeclarationNode::TyCon kind;
     47                std::string name;
     48                DeclarationNode *params;
     49                ExpressionNode *actuals;                                                // holds actual parameters later applied to AggInst
     50                DeclarationNode *members;
     51        };
    3752
    38     struct AggInst_t {
    39         TypeData *aggregate;
    40         ExpressionNode *params;
    41     };
     53        struct AggInst_t {
     54                TypeData *aggregate;
     55                ExpressionNode *params;
     56        };
    4257
    43     struct Array_t {
    44         ExpressionNode *dimension;
    45         bool isVarLen;
    46         bool isStatic;
    47     };
     58        struct Array_t {
     59                ExpressionNode *dimension;
     60                bool isVarLen;
     61                bool isStatic;
     62        };
    4863
    49     struct Enumeration_t {
    50         std::string name;
    51         DeclarationNode *constants;
    52     };
     64        struct Enumeration_t {
     65                std::string name;
     66                DeclarationNode *constants;
     67        };
    5368
    54     struct Function_t {
    55         DeclarationNode *params;
    56         DeclarationNode *idList;                        // old-style
    57         DeclarationNode *oldDeclList;
    58         StatementNode *body;
    59         bool hasBody;
    60         bool newStyle;
    61     };
     69        struct Function_t {
     70                DeclarationNode *params;
     71                DeclarationNode *idList;                                                // old-style
     72                DeclarationNode *oldDeclList;
     73                StatementNode *body;
     74                bool hasBody;
     75                bool newStyle;
     76        };
    6277
    63     struct Symbolic_t {
    64         std::string name;
    65         bool isTypedef;
    66         DeclarationNode *params;
    67         ExpressionNode *actuals;
    68         DeclarationNode *assertions;
    69     };
     78        struct Symbolic_t {
     79                std::string name;
     80                bool isTypedef;
     81                DeclarationNode *params;
     82                ExpressionNode *actuals;
     83                DeclarationNode *assertions;
     84        };
    7085
    71     struct Variable_t {
    72         DeclarationNode::TypeClass tyClass;
    73         std::string name;
    74         DeclarationNode *assertions;
    75     };
     86        struct Variable_t {
     87                DeclarationNode::TypeClass tyClass;
     88                std::string name;
     89                DeclarationNode *assertions;
     90        };
    7691
    77     struct Tuple_t {
    78         DeclarationNode *members;
    79     };
     92        struct Tuple_t {
     93                DeclarationNode *members;
     94        };
    8095 
    81     struct Typeof_t {
    82         ExpressionNode *expr;
    83     };
     96        struct Typeof_t {
     97                ExpressionNode *expr;
     98        };
    8499
    85     struct Attr_t {
    86         std::string name;
    87         ExpressionNode *expr;
    88         DeclarationNode *type;
    89     };
     100        struct Attr_t {
     101                std::string name;
     102                ExpressionNode *expr;
     103                DeclarationNode *type;
     104        };
    90105
    91     union {
    92         Basic_t *basic;
    93         Aggregate_t *aggregate;
    94         AggInst_t *aggInst;
    95         Array_t *array;
    96         Enumeration_t *enumeration;
    97         Function_t *function;
    98         Symbolic_t *symbolic;
    99         Variable_t *variable;
    100         Tuple_t *tuple;
    101         Typeof_t *typeexpr;
    102         Attr_t *attr;
    103     };
     106        union {
     107                Basic_t *basic;
     108                Aggregate_t *aggregate;
     109                AggInst_t *aggInst;
     110                Array_t *array;
     111                Enumeration_t *enumeration;
     112                Function_t *function;
     113                Symbolic_t *symbolic;
     114                Variable_t *variable;
     115                Tuple_t *tuple;
     116                Typeof_t *typeexpr;
     117                Attr_t *attr;
     118        };
    104119
    105     TypeData *extractAggregate( bool toplevel = true ) const;
    106     // helper function for DeclNodeImpl::build
    107     Declaration * buildDecl( std::string name, Declaration::StorageClass sc, Expression *bitfieldWidth, bool isInline, LinkageSpec::Type linkage, Initializer *init = 0 ) const;
    108     // helper functions for build()
    109     Type::Qualifiers buildQualifiers() const;
    110     Type *buildBasicType() const;
    111     PointerType * buildPointer() const;
    112     ArrayType * buildArray() const;
    113     AggregateDecl * buildAggregate() const;
    114     ReferenceToType * buildAggInst() const;
    115     NamedTypeDecl * buildSymbolic( const std::string &name, Declaration::StorageClass sc ) const;
    116     TypeDecl* buildVariable() const;
    117     EnumDecl* buildEnum() const;
    118     TypeInstType * buildSymbolicInst() const;
    119     TupleType * buildTuple() const;
    120     TypeofType * buildTypeof() const;
    121     AttrType * buildAttr() const;
     120        TypeData *extractAggregate( bool toplevel = true ) const;
     121        // helper function for DeclNodeImpl::build
     122        Declaration * buildDecl( std::string name, Declaration::StorageClass sc, Expression *bitfieldWidth, bool isInline, LinkageSpec::Type linkage, Initializer *init = 0 ) const;
     123        // helper functions for build()
     124        Type::Qualifiers buildQualifiers() const;
     125        Type *buildBasicType() const;
     126        PointerType * buildPointer() const;
     127        ArrayType * buildArray() const;
     128        AggregateDecl * buildAggregate() const;
     129        ReferenceToType * buildAggInst() const;
     130        NamedTypeDecl * buildSymbolic( const std::string &name, Declaration::StorageClass sc ) const;
     131        TypeDecl* buildVariable() const;
     132        EnumDecl* buildEnum() const;
     133        TypeInstType * buildSymbolicInst() const;
     134        TupleType * buildTuple() const;
     135        TypeofType * buildTypeof() const;
     136        AttrType * buildAttr() const;
    122137};
    123138
    124139#endif // TYPEDATA_H
     140
     141// Local Variables: //
     142// tab-width: 4 //
     143// mode: c++ //
     144// compile-command: "make install" //
     145// End: //
Note: See TracChangeset for help on using the changeset viewer.