Changeset c8ffe20b for translator/Parser/TypeData.h
- Timestamp:
- Nov 15, 2014, 10:46:42 PM (10 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/Parser/TypeData.h
r8c17ab0 rc8ffe20b 10 10 #include "LinkageSpec.h" 11 11 12 struct TypeData 13 { 14 enum Kind { Unknown, Basic, Pointer, Array, Function, Aggregate, AggregateInst, 15 Enum, EnumConstant, Symbolic, SymbolicInst, Variable, Tuple, Typeof, Attr } kind; 12 struct TypeData { 13 enum Kind { Unknown, Basic, Pointer, Array, Function, Aggregate, AggregateInst, 14 Enum, EnumConstant, Symbolic, SymbolicInst, Variable, Tuple, Typeof, Attr } kind; 16 15 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; 21 20 22 Type *build() const;23 FunctionType *buildFunction() const;21 Type *build() const; 22 FunctionType *buildFunction() const; 24 23 25 TypeData *base;26 std::list< DeclarationNode::Qualifier > qualifiers;27 DeclarationNode *forall;24 TypeData *base; 25 std::list< DeclarationNode::Qualifier > qualifiers; 26 DeclarationNode *forall; 28 27 29 struct Basic_t {30 31 32 };28 struct Basic_t { 29 std::list< DeclarationNode::BasicType > typeSpec; 30 std::list< DeclarationNode::Modifier > modifiers; 31 }; 33 32 34 struct Aggregate_t {35 36 37 38 ExpressionNode *actuals; // holds actual parameters that will later beapplied to AggInst39 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 }; 41 40 42 struct AggInst_t {43 44 45 };41 struct AggInst_t { 42 TypeData *aggregate; 43 ExpressionNode *params; 44 }; 46 45 47 struct Array_t {48 49 50 51 };46 struct Array_t { 47 ExpressionNode *dimension; 48 bool isVarLen; 49 bool isStatic; 50 }; 52 51 53 struct Enumeration_t {54 55 56 };52 struct Enumeration_t { 53 std::string name; 54 DeclarationNode *constants; 55 }; 57 56 58 struct Function_t {59 60 DeclarationNode *idList;// old-style61 62 63 64 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 }; 66 65 67 struct Symbolic_t {68 69 70 71 72 73 };66 struct Symbolic_t { 67 std::string name; 68 bool isTypedef; 69 DeclarationNode *params; 70 ExpressionNode *actuals; 71 DeclarationNode *assertions; 72 }; 74 73 75 struct Variable_t {76 77 78 79 };74 struct Variable_t { 75 DeclarationNode::TypeClass tyClass; 76 std::string name; 77 DeclarationNode *assertions; 78 }; 80 79 81 struct Tuple_t {82 83 };80 struct Tuple_t { 81 DeclarationNode *members; 82 }; 84 83 85 struct Typeof_t {86 87 };84 struct Typeof_t { 85 ExpressionNode *expr; 86 }; 88 87 89 struct Attr_t {90 91 92 93 };88 struct Attr_t { 89 std::string name; 90 ExpressionNode *expr; 91 DeclarationNode *type; 92 }; 94 93 95 union {96 97 98 99 100 101 102 103 104 105 106 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 }; 108 107 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; 126 125 }; 127 126 128 #endif / * #ifndef TYPEDATA_H */127 #endif // TYPEDATA_H
Note: See TracChangeset
for help on using the changeset viewer.