Ignore:
Timestamp:
Nov 15, 2014, 10:46:42 PM (10 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:
1ead581
Parents:
8c17ab0
Message:

reformat files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/Parser/TypeData.h

    r8c17ab0 rc8ffe20b  
    1010#include "LinkageSpec.h"
    1111
    12 struct TypeData
    13 {
    14   enum Kind { Unknown, Basic, Pointer, Array, Function, Aggregate, AggregateInst,
    15               Enum, EnumConstant, Symbolic, SymbolicInst, Variable, Tuple, Typeof, Attr } kind;
     12struct TypeData {
     13    enum Kind { Unknown, Basic, Pointer, Array, Function, Aggregate, AggregateInst,
     14                Enum, EnumConstant, Symbolic, SymbolicInst, Variable, Tuple, Typeof, Attr } kind;
    1615
    17   TypeData( Kind k = Unknown );
    18   ~TypeData();
    19   void print( std::ostream &, int indent = 0 ) const;
    20   TypeData *clone() const;
     16    TypeData( Kind k = Unknown );
     17    ~TypeData();
     18    void print( std::ostream &, int indent = 0 ) const;
     19    TypeData *clone() const;
    2120
    22   Type *build() const;
    23   FunctionType *buildFunction() const;
     21    Type *build() const;
     22    FunctionType *buildFunction() const;
    2423
    25   TypeData *base;
    26   std::list< DeclarationNode::Qualifier > qualifiers;
    27   DeclarationNode *forall;
     24    TypeData *base;
     25    std::list< DeclarationNode::Qualifier > qualifiers;
     26    DeclarationNode *forall;
    2827
    29   struct Basic_t {
    30     std::list< DeclarationNode::BasicType > typeSpec;
    31     std::list< DeclarationNode::Modifier > modifiers;
    32   };
     28    struct Basic_t {
     29        std::list< DeclarationNode::BasicType > typeSpec;
     30        std::list< DeclarationNode::Modifier > modifiers;
     31    };
    3332
    34   struct Aggregate_t {
    35     DeclarationNode::TyCon kind;
    36     std::string name;
    37     DeclarationNode *params;
    38     ExpressionNode *actuals;    // holds actual parameters that will later be applied to AggInst
    39     DeclarationNode *members;
    40   };
     33    struct Aggregate_t {
     34        DeclarationNode::TyCon kind;
     35        std::string name;
     36        DeclarationNode *params;
     37        ExpressionNode *actuals;                        // holds actual parameters later applied to AggInst
     38        DeclarationNode *members;
     39    };
    4140
    42   struct AggInst_t {
    43     TypeData *aggregate;
    44     ExpressionNode *params;
    45   };
     41    struct AggInst_t {
     42        TypeData *aggregate;
     43        ExpressionNode *params;
     44    };
    4645
    47   struct Array_t {
    48     ExpressionNode *dimension;
    49     bool isVarLen;
    50     bool isStatic;
    51   };
     46    struct Array_t {
     47        ExpressionNode *dimension;
     48        bool isVarLen;
     49        bool isStatic;
     50    };
    5251
    53   struct Enumeration_t {
    54     std::string name;
    55     DeclarationNode *constants;
    56   };
     52    struct Enumeration_t {
     53        std::string name;
     54        DeclarationNode *constants;
     55    };
    5756
    58   struct Function_t {
    59     DeclarationNode *params;
    60     DeclarationNode *idList; // old-style
    61     DeclarationNode *oldDeclList;
    62     StatementNode *body;
    63     bool hasBody;
    64     bool newStyle;
    65   };
     57    struct Function_t {
     58        DeclarationNode *params;
     59        DeclarationNode *idList;                        // old-style
     60        DeclarationNode *oldDeclList;
     61        StatementNode *body;
     62        bool hasBody;
     63        bool newStyle;
     64    };
    6665
    67   struct Symbolic_t {
    68     std::string name;
    69     bool isTypedef;
    70     DeclarationNode *params;
    71     ExpressionNode *actuals;
    72     DeclarationNode *assertions;
    73   };
     66    struct Symbolic_t {
     67        std::string name;
     68        bool isTypedef;
     69        DeclarationNode *params;
     70        ExpressionNode *actuals;
     71        DeclarationNode *assertions;
     72    };
    7473
    75   struct Variable_t {
    76     DeclarationNode::TypeClass tyClass;
    77     std::string name;
    78     DeclarationNode *assertions;
    79   };
     74    struct Variable_t {
     75        DeclarationNode::TypeClass tyClass;
     76        std::string name;
     77        DeclarationNode *assertions;
     78    };
    8079
    81   struct Tuple_t {
    82     DeclarationNode *members;
    83   };
     80    struct Tuple_t {
     81        DeclarationNode *members;
     82    };
    8483 
    85   struct Typeof_t {
    86     ExpressionNode *expr;
    87   };
     84    struct Typeof_t {
     85        ExpressionNode *expr;
     86    };
    8887
    89   struct Attr_t {
    90     std::string name;
    91     ExpressionNode *expr;
    92     DeclarationNode *type;
    93   };
     88    struct Attr_t {
     89        std::string name;
     90        ExpressionNode *expr;
     91        DeclarationNode *type;
     92    };
    9493
    95   union {
    96     Basic_t *basic;
    97     Aggregate_t *aggregate;
    98     AggInst_t *aggInst;
    99     Array_t *array;
    100     Enumeration_t *enumeration;
    101     Function_t *function;
    102     Symbolic_t *symbolic;
    103     Variable_t *variable;
    104     Tuple_t *tuple;
    105     Typeof_t *typeexpr;
    106     Attr_t *attr;
    107   };
     94    union {
     95        Basic_t *basic;
     96        Aggregate_t *aggregate;
     97        AggInst_t *aggInst;
     98        Array_t *array;
     99        Enumeration_t *enumeration;
     100        Function_t *function;
     101        Symbolic_t *symbolic;
     102        Variable_t *variable;
     103        Tuple_t *tuple;
     104        Typeof_t *typeexpr;
     105        Attr_t *attr;
     106    };
    108107
    109   TypeData *extractAggregate( bool toplevel = true ) const;
    110   /* helper function for DeclNodeImpl::build */
    111   Declaration * buildDecl( std::string name, Declaration::StorageClass sc, Expression *bitfieldWidth, bool isInline, LinkageSpec::Type linkage, Initializer *init = 0 ) const;
    112   /* helper functions for build() */
    113   Type::Qualifiers buildQualifiers() const;
    114   Type *buildBasicType() const;
    115   PointerType * buildPointer() const;
    116   ArrayType * buildArray() const;
    117   AggregateDecl * buildAggregate() const;
    118   ReferenceToType * buildAggInst() const;
    119   NamedTypeDecl * buildSymbolic( const std::string &name, Declaration::StorageClass sc ) const;
    120   TypeDecl* buildVariable() const;
    121   EnumDecl* buildEnum() const;
    122   TypeInstType * buildSymbolicInst() const;
    123   TupleType * buildTuple() const;
    124   TypeofType * buildTypeof() const;
    125   AttrType * buildAttr() const;
     108    TypeData *extractAggregate( bool toplevel = true ) const;
     109    // helper function for DeclNodeImpl::build
     110    Declaration * buildDecl( std::string name, Declaration::StorageClass sc, Expression *bitfieldWidth, bool isInline, LinkageSpec::Type linkage, Initializer *init = 0 ) const;
     111    // helper functions for build()
     112    Type::Qualifiers buildQualifiers() const;
     113    Type *buildBasicType() const;
     114    PointerType * buildPointer() const;
     115    ArrayType * buildArray() const;
     116    AggregateDecl * buildAggregate() const;
     117    ReferenceToType * buildAggInst() const;
     118    NamedTypeDecl * buildSymbolic( const std::string &name, Declaration::StorageClass sc ) const;
     119    TypeDecl* buildVariable() const;
     120    EnumDecl* buildEnum() const;
     121    TypeInstType * buildSymbolicInst() const;
     122    TupleType * buildTuple() const;
     123    TypeofType * buildTypeof() const;
     124    AttrType * buildAttr() const;
    126125};
    127126
    128 #endif /* #ifndef TYPEDATA_H */
     127#endif // TYPEDATA_H
Note: See TracChangeset for help on using the changeset viewer.