Changeset b87a5ed for translator/Parser/TypeData.h
- Timestamp:
- May 16, 2015, 3:36:19 PM (9 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:
- a32b204
- Parents:
- b8508a2
- 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 1 16 #ifndef TYPEDATA_H 2 17 #define TYPEDATA_H … … 8 23 9 24 struct TypeData { 10 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; 12 27 13 14 15 16 28 TypeData( Kind k = Unknown ); 29 ~TypeData(); 30 void print( std::ostream &, int indent = 0 ) const; 31 TypeData *clone() const; 17 32 18 19 33 Type *build() const; 34 FunctionType *buildFunction() const; 20 35 21 22 23 36 TypeData *base; 37 std::list< DeclarationNode::Qualifier > qualifiers; 38 DeclarationNode *forall; 24 39 25 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 }; 29 44 30 31 DeclarationNode::TyCon kind;32 std::string name;33 DeclarationNode *params;34 ExpressionNode *actuals;// holds actual parameters later applied to AggInst35 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 }; 37 52 38 39 TypeData *aggregate;40 ExpressionNode *params;41 53 struct AggInst_t { 54 TypeData *aggregate; 55 ExpressionNode *params; 56 }; 42 57 43 44 ExpressionNode *dimension;45 bool isVarLen;46 bool isStatic;47 58 struct Array_t { 59 ExpressionNode *dimension; 60 bool isVarLen; 61 bool isStatic; 62 }; 48 63 49 50 std::string name;51 DeclarationNode *constants;52 64 struct Enumeration_t { 65 std::string name; 66 DeclarationNode *constants; 67 }; 53 68 54 55 DeclarationNode *params;56 DeclarationNode *idList;// old-style57 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 }; 62 77 63 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 }; 70 85 71 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 }; 76 91 77 78 DeclarationNode *members;79 92 struct Tuple_t { 93 DeclarationNode *members; 94 }; 80 95 81 82 ExpressionNode *expr;83 96 struct Typeof_t { 97 ExpressionNode *expr; 98 }; 84 99 85 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 }; 90 105 91 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 }; 104 119 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 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; 122 137 }; 123 138 124 139 #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.